Expand description
Adds an environment variable to the environment of the child process.
use cradle::prelude::*;
let StdoutUntrimmed(output) = run_output!("env", Env("FOO", "bar"));
assert!(output.contains("FOO=bar\n"));
Child processes inherit the environment of the parent process.
Env
only adds environment variables to that inherited environment.
If the environment variable is also set in the parent process,
it is overwritten by Env
.
Tuple Fields
0: Key
1: Value
Trait Implementations
sourceimpl<Key: Clone, Value: Clone> Clone for Env<Key, Value> where
Key: AsRef<OsStr>,
Value: AsRef<OsStr>,
impl<Key: Clone, Value: Clone> Clone for Env<Key, Value> where
Key: AsRef<OsStr>,
Value: AsRef<OsStr>,
sourceimpl<Key: Debug, Value: Debug> Debug for Env<Key, Value> where
Key: AsRef<OsStr>,
Value: AsRef<OsStr>,
impl<Key: Debug, Value: Debug> Debug for Env<Key, Value> where
Key: AsRef<OsStr>,
Value: AsRef<OsStr>,
sourceimpl<Key, Value> Input for Env<Key, Value> where
Key: AsRef<OsStr>,
Value: AsRef<OsStr>,
impl<Key, Value> Input for Env<Key, Value> where
Key: AsRef<OsStr>,
Value: AsRef<OsStr>,
Auto Trait Implementations
impl<Key, Value> RefUnwindSafe for Env<Key, Value> where
Key: RefUnwindSafe,
Value: RefUnwindSafe,
impl<Key, Value> Send for Env<Key, Value> where
Key: Send,
Value: Send,
impl<Key, Value> Sync for Env<Key, Value> where
Key: Sync,
Value: Sync,
impl<Key, Value> Unpin for Env<Key, Value> where
Key: Unpin,
Value: Unpin,
impl<Key, Value> UnwindSafe for Env<Key, Value> where
Key: UnwindSafe,
Value: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more