pub struct Environment { /* private fields */ }Expand description
A home directory and the environment variables that relocate tools.
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn new(home: impl Into<PathBuf>) -> Self
pub fn new(home: impl Into<PathBuf>) -> Self
An environment with the given home and no variables set.
Sourcepub fn with_var(
self,
name: impl Into<String>,
value: impl Into<OsString>,
) -> Self
pub fn with_var( self, name: impl Into<String>, value: impl Into<OsString>, ) -> Self
The same environment with one variable set.
Sourcepub fn from_process() -> Option<Self>
pub fn from_process() -> Option<Self>
The environment of the running process.
Returns None when no home directory can be found, because every
target lives below it and guessing one would write somewhere unknown.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§impl Debug for Environment
Names only: the process environment holds tokens and passwords, and a
program that logs its environment must not log those.
impl Debug for Environment
Names only: the process environment holds tokens and passwords, and a program that logs its environment must not log those.
impl Eq for Environment
Source§impl PartialEq for Environment
impl PartialEq for Environment
impl StructuralPartialEq for Environment
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnsafeUnpin for Environment
impl UnwindSafe for Environment
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