File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,4 +25,4 @@ tempfile = "3.4.0"
2525members = [" ." ]
2626
2727[workspace .dependencies ]
28- sys_traits = " 0.1.7 "
28+ sys_traits = " 0.1.10 "
Original file line number Diff line number Diff line change 11[toolchain ]
2- channel = " 1.81 .0"
2+ channel = " 1.86 .0"
33components = [" rustfmt" , " clippy" ]
Original file line number Diff line number Diff line change @@ -55,15 +55,13 @@ pub fn canonicalize_path_maybe_not_exists(
5555 }
5656}
5757
58- pub fn atomic_write_file_with_retries <
59- TSys : FsCreateDirAll
60- + FsMetadata
61- + FsOpen
62- + FsRemoveFile
63- + FsRename
64- + ThreadSleep
65- + SystemRandom ,
66- > (
58+ #[ sys_traits:: auto_impl]
59+ pub trait AtomicWriteFileWithRetriesSys :
60+ AtomicWriteFileSys + ThreadSleep
61+ {
62+ }
63+
64+ pub fn atomic_write_file_with_retries < TSys : AtomicWriteFileWithRetriesSys > (
6765 sys : & TSys ,
6866 file_path : & Path ,
6967 data : & [ u8 ] ,
@@ -86,21 +84,25 @@ pub fn atomic_write_file_with_retries<
8684 }
8785}
8886
87+ #[ sys_traits:: auto_impl]
88+ pub trait AtomicWriteFileSys :
89+ FsCreateDirAll + FsMetadata + FsOpen + FsRemoveFile + FsRename + SystemRandom
90+ {
91+ }
92+
8993/// Writes the file to the file system at a temporary path, then
9094/// renames it to the destination in a single sys call in order
9195/// to never leave the file system in a corrupted state.
9296///
9397/// This also handles creating the directory if a NotFound error
9498/// occurs.
95- pub fn atomic_write_file <
96- TSys : FsCreateDirAll + FsMetadata + FsOpen + FsRemoveFile + FsRename + SystemRandom ,
97- > (
99+ pub fn atomic_write_file < TSys : AtomicWriteFileSys > (
98100 sys : & TSys ,
99101 file_path : & Path ,
100102 data : & [ u8 ] ,
101103 mode : u32 ,
102104) -> std:: io:: Result < ( ) > {
103- fn atomic_write_file_raw < TSys : FsOpen + FsRename + FsRemoveFile > (
105+ fn atomic_write_file_raw < TSys : AtomicWriteFileSys > (
104106 sys : & TSys ,
105107 temp_file_path : & Path ,
106108 file_path : & Path ,
You can’t perform that action at this time.
0 commit comments