File tree Expand file tree Collapse file tree 2 files changed +0
-15
lines changed Expand file tree Collapse file tree 2 files changed +0
-15
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ edition = "2021"
77
88[dependencies ]
99atomic-write-file = { path = " ../.." }
10- nix = " 0.28.0"
1110
1211[features ]
1312unnamed-tmpfile = [" atomic-write-file/unnamed-tmpfile" ]
Original file line number Diff line number Diff line change 11use atomic_write_file:: AtomicWriteFile ;
2- use nix:: unistd:: close;
3- use nix:: unistd:: fsync;
42use std:: io:: Write ;
5- use std:: os:: fd:: AsFd ;
6- use std:: os:: fd:: AsRawFd ;
73
84fn main ( ) {
95 let mut file = AtomicWriteFile :: open ( "/test/file" ) . expect ( "open failed" ) ;
10- let dir = file
11- . directory ( )
12- . expect ( "could not obtain directory fd" )
13- . as_fd ( )
14- . try_clone_to_owned ( )
15- . expect ( "could not duplicate directory fd" ) ;
16-
176 file. write_all ( b"hello" ) . expect ( "write failed" ) ;
187 file. commit ( ) . expect ( "commit failed" ) ;
19-
20- fsync ( dir. as_raw_fd ( ) ) . expect ( "directory sync failed" ) ;
21- close ( dir. as_raw_fd ( ) ) . expect ( "closing directory failed" ) ;
228}
You can’t perform that action at this time.
0 commit comments