[−][src]Struct chwd::ChangeWorkingDirectory
Implementations
impl ChangeWorkingDirectory
[src]
pub fn change(new_directory: &impl AsRef<Path>) -> Result<Self, Error>
[src]
Store the current working directory, then change it to the supplied path. When the struct goes out of scope, the current working directory will be changed back to what it originally was.
use std::env; use chwd::ChangeWorkingDirectory; use std::io; fn main() -> Result<(), std::io::Error> { { let _dir_change = ChangeWorkingDirectory::change(&env::temp_dir())?; // Do something in the temp dir } // _dir_change has gone out of scope, you will be back where you started. Ok(()) }
Trait Implementations
impl Debug for ChangeWorkingDirectory
[src]
impl Drop for ChangeWorkingDirectory
[src]
Auto Trait Implementations
impl RefUnwindSafe for ChangeWorkingDirectory
impl Send for ChangeWorkingDirectory
impl Sync for ChangeWorkingDirectory
impl Unpin for ChangeWorkingDirectory
impl UnwindSafe for ChangeWorkingDirectory
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,