pub struct TmpFile(/* private fields */);
Expand description
Handle a temporary file.
When this struct is dropped, the temporary file itself is automatically deleted.
Implementations§
Source§impl TmpFile
impl TmpFile
Sourcepub fn write<C>(&self, contents: C) -> Result<()>
pub fn write<C>(&self, contents: C) -> Result<()>
Write to the temporary file. Akin to fs::write
.
Sourcepub fn open_readable(&self) -> Result<File>
pub fn open_readable(&self) -> Result<File>
Open the temporary file in read-only mode. Akin to
File::open
.
Sourcepub fn open_writable(&self) -> Result<File>
pub fn open_writable(&self) -> Result<File>
Open the temporary file in write-only mode.
Sourcepub fn open_with_opts(&self, opts: &mut OpenOptions) -> Result<File>
pub fn open_with_opts(&self, opts: &mut OpenOptions) -> Result<File>
Open the temporary file using the provided OpenOptions.
Akin to fs::OpenOptions::open
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TmpFile
impl RefUnwindSafe for TmpFile
impl Send for TmpFile
impl Sync for TmpFile
impl Unpin for TmpFile
impl UnwindSafe for TmpFile
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