[−][src]Struct sys_util::TempDir
Create and remove a temporary directory. The directory will be maintained for the lifetime of
the TempDir
object.
Methods
impl TempDir
[src]
pub fn new<P: AsRef<OsStr>>(prefix: P) -> Result<TempDir>
[src]
Creates a new tempory directory. The directory will be removed when the object goes out of scope.
Examples
let t = TempDir::new("/tmp/testdir").map_err(|_| ())?; assert!(t.as_path().unwrap().exists());
pub fn remove(self) -> Result<()>
[src]
Removes the temporary directory. Calling this is optional as dropping a TempDir
object
will also remove the directory. Calling remove explicitly allows for better error handling.
pub fn as_path(&self) -> Option<&Path>
[src]
Returns the path to the tempdir if it is currently valid
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,