pub struct TempDirectory { /* private fields */ }Expand description
Represents a temporary directory.
By default this temporary directory is deleted when this struct is dropped.
Implementations§
Source§impl TempDirectory
impl TempDirectory
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
Examples found in repository?
examples/builder.rs (line 13)
3fn main() {
4 let temp_directory = TempDirectoryBuilder::default()
5 .add_text_file("test/foo.txt", "bar")
6 .add_empty_file("test/folder-a/folder-b/bar.txt")
7 .add_file("test_file.rs", file!())
8 .build()
9 .expect("create tree fs");
10
11 println!(
12 "created successfully in {}",
13 temp_directory.path().display()
14 );
15
16 let path = temp_directory.path().to_path_buf();
17
18 assert!(path.exists());
19
20 drop(temp_directory);
21
22 assert!(!path.exists());
23}Trait Implementations§
Source§impl Debug for TempDirectory
impl Debug for TempDirectory
Auto Trait Implementations§
impl Freeze for TempDirectory
impl RefUnwindSafe for TempDirectory
impl Send for TempDirectory
impl Sync for TempDirectory
impl Unpin for TempDirectory
impl UnwindSafe for TempDirectory
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