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§fn clone(&self) -> ShellVariableMap
fn clone(&self) -> ShellVariableMap
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShellVariableMap
impl Debug for ShellVariableMap
Source§impl Default for ShellVariableMap
impl Default for ShellVariableMap
Source§fn default() -> ShellVariableMap
fn default() -> ShellVariableMap
Returns the “default value” for a type. 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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