pub struct TempDir { /* private fields */ }Expand description
Managed temporary directory. All contents are cleaned up on drop.
Implementations§
Source§impl TempDir
impl TempDir
Sourcepub fn child(&self, rel_path: impl AsRef<Path>) -> AppResult<PathBuf>
pub fn child(&self, rel_path: impl AsRef<Path>) -> AppResult<PathBuf>
Create a child path within this temp directory.
Sourcepub fn write_file(
&self,
rel_path: impl AsRef<Path>,
content: &[u8],
) -> AppResult<PathBuf>
pub fn write_file( &self, rel_path: impl AsRef<Path>, content: &[u8], ) -> AppResult<PathBuf>
Write a file at a relative path within this temp directory.
Sourcepub fn create_file(&self, name: &str) -> AppResult<TempFile>
pub fn create_file(&self, name: &str) -> AppResult<TempFile>
Create a named file inside this temp directory.
Sourcepub fn create_file_with_extension(&self, ext: &str) -> AppResult<TempFile>
pub fn create_file_with_extension(&self, ext: &str) -> AppResult<TempFile>
Create a file with the given extension inside this temp directory.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TempDir
impl RefUnwindSafe for TempDir
impl Send for TempDir
impl Sync for TempDir
impl Unpin for TempDir
impl UnsafeUnpin for TempDir
impl UnwindSafe for TempDir
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