pub struct ShellVariableMap { /* private fields */ }Expand description
Represents a map from names to shell variables.
Implementations§
Source§impl ShellVariableMap
impl ShellVariableMap
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &ShellVariable)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &ShellVariable)>
Returns an iterator over all the variables in the map.
Sourcepub fn get(&self, name: &str) -> Option<&ShellVariable>
pub fn get(&self, name: &str) -> Option<&ShellVariable>
Tries to retrieve an immutable reference to the variable with the given name.
§Arguments
name- The name of the variable to retrieve.
Sourcepub fn get_mut(&mut self, name: &str) -> Option<&mut ShellVariable>
pub fn get_mut(&mut self, name: &str) -> Option<&mut ShellVariable>
Tries to retrieve a mutable reference to the variable with the given name.
§Arguments
name- The name of the variable to retrieve.
Sourcepub fn unset(&mut self, name: &str) -> Option<ShellVariable>
pub fn unset(&mut self, name: &str) -> Option<ShellVariable>
Tries to unset the variable with the given name, returning the removed variable or None if it was not already set.
§Arguments
name- The name of the variable to unset.
Sourcepub fn set<N: Into<String>>(
&mut self,
name: N,
var: ShellVariable,
) -> Option<ShellVariable>
pub fn set<N: Into<String>>( &mut self, name: N, var: ShellVariable, ) -> Option<ShellVariable>
Sets a variable in the map.
§Arguments
name- The name of the variable to set.var- The variable to set.
Trait Implementations§
Source§impl Clone for ShellVariableMap
impl Clone for ShellVariableMap
Source§impl Debug for ShellVariableMap
impl Debug for ShellVariableMap
Source§impl Default for ShellVariableMap
impl Default for ShellVariableMap
Source§impl<'de> Deserialize<'de> for ShellVariableMap
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ShellVariableMap
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ShellVariableMap
impl RefUnwindSafe for ShellVariableMap
impl Send for ShellVariableMap
impl Sync for ShellVariableMap
impl Unpin for ShellVariableMap
impl UnsafeUnpin for ShellVariableMap
impl UnwindSafe for ShellVariableMap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more