pub struct Environment { /* private fields */ }
Expand description
Structure to deal with environment variables
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn inherit() -> Self
pub fn inherit() -> Self
Create a new Environment that inherits this process’ environment.
§Examples
extern crate environment;
use std::ffi::OsString;
let e = environment::Environment::inherit().compile();
let e_: Vec<(OsString, OsString)> = ::std::env::vars_os().collect();
assert_eq!(e, e_);
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create a new Environment independent of the current process’s Environment
§Examples
extern crate environment;
let e = environment::Environment::empty().compile();
assert_eq!(e, Vec::new());
Sourcepub fn insert<S1: Into<OsString>, S2: Into<OsString>>(
self,
key: S1,
val: S2,
) -> Self
pub fn insert<S1: Into<OsString>, S2: Into<OsString>>( self, key: S1, val: S2, ) -> Self
Insert a new entry into the custom variables for this environment object
§Examples
extern crate environment;
use std::ffi::OsString;
let e = environment::Environment::empty().insert("foo", "bar").compile();
assert_eq!(e, vec![(OsString::from("foo"), OsString::from("bar"))]);
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Environment
impl Debug for Environment
Source§impl Default for Environment
impl Default for Environment
Source§impl<'a> From<&'a Environment> for Environment
Implicit clone for ergonomics
impl<'a> From<&'a Environment> for Environment
Implicit clone for ergonomics
Source§fn from(v: &'a Environment) -> Self
fn from(v: &'a Environment) -> Self
Converts to this type from the input type.
Source§impl<'s, T> From<T> for Environment
impl<'s, T> From<T> for Environment
Source§impl PartialEq for Environment
impl PartialEq for Environment
impl Eq 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 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