pub struct TempFile {
pub f: File,
pub path: PathBuf,
/* private fields */
}Expand description
TempFile contains information about a created temporary file and will remove the temporary file after the object goes out of scope. This is a convenience structure over create_temp results.
Fields§
§f: File§path: PathBufImplementations§
Source§impl TempFile
impl TempFile
Sourcepub fn new(pattern: &str) -> Result<Self>
pub fn new(pattern: &str) -> Result<Self>
new creates a new temporary file in the default directory for temporary files. The new file’s name is generated by adding a random string to the end of pattern. If pattern includes a “”, the random string replaces the last “” instead. The temporary file will be removed when the object goes out of scope.
Sourcepub fn new_in_dir(dir: &Path, pattern: &str) -> Result<Self>
pub fn new_in_dir(dir: &Path, pattern: &str) -> Result<Self>
new_in_dir is the same as new, except that the directory dir is used instead
of the system directory for temporary files.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TempFile
impl RefUnwindSafe for TempFile
impl Send for TempFile
impl Sync for TempFile
impl Unpin for TempFile
impl UnwindSafe for TempFile
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