Struct fencryption_lib::tmp::TmpFile
source · pub struct TmpFile(_);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<()>where
C: AsRef<[u8]>,
pub fn write<C>(&self, contents: C) -> Result<()>where C: AsRef<[u8]>,
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.