pub struct SafeFileCreator { /* private fields */ }Implementations§
Source§impl SafeFileCreator
impl SafeFileCreator
Sourcepub fn new<P: AsRef<Path>>(dest_path: P) -> Result<Self>
pub fn new<P: AsRef<Path>>(dest_path: P) -> Result<Self>
Safely creates a new file at a specific location. Ensures the file is not created with elevated privileges, and a temporary file is created then renamed on close.
Sourcepub fn new_unnamed(temp_root: impl AsRef<Path>) -> Result<Self>
pub fn new_unnamed(temp_root: impl AsRef<Path>) -> Result<Self>
Safely creates a new file while a destination name can’t be decided now. Users need to call
ⓘ
pub fn set_dest_path<P: AsRef<Path>>(dest_path: P)to set the destination before closing the file.
Sourcepub fn replace_existing<P: AsRef<Path>>(dest_path: P) -> Result<Self>
pub fn replace_existing<P: AsRef<Path>>(dest_path: P) -> Result<Self>
Safely replaces a new file at a specific location. Ensures the file is not created with elevated privileges, and additionally the metadata of the old one will match the new metadata.
pub fn set_dest_path<P: AsRef<Path>>(&mut self, dest_path: P)
pub fn abort(&mut self) -> Result<()>
Trait Implementations§
Source§impl Drop for SafeFileCreator
impl Drop for SafeFileCreator
Source§impl Seek for SafeFileCreator
impl Seek for SafeFileCreator
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. Read more
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Rewind to the beginning of a stream. Read more
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
🔬This is a nightly-only experimental API. (
seek_stream_len)Returns the length of this stream (in bytes). Read more
Source§impl Write for SafeFileCreator
impl Write for SafeFileCreator
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl Freeze for SafeFileCreator
impl RefUnwindSafe for SafeFileCreator
impl Send for SafeFileCreator
impl Sync for SafeFileCreator
impl Unpin for SafeFileCreator
impl UnsafeUnpin for SafeFileCreator
impl UnwindSafe for SafeFileCreator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more