pub struct StrVarMap { /* private fields */ }Expand description
Implementations§
Source§impl StrVarMap
impl StrVarMap
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Removes all keys and resets the arena. See VarMap::clear.
Sourcepub fn set<T>(&mut self, var_name: &str, value: T)where
T: VarMapValue,
pub fn set<T>(&mut self, var_name: &str, value: T)where
T: VarMapValue,
Inserts or overwrites var_name with value. See VarMap::set.
Sourcepub fn update<T>(&mut self, var_name: &str, f: impl FnOnce(&mut T)) -> boolwhere
T: VarMapValue,
pub fn update<T>(&mut self, var_name: &str, f: impl FnOnce(&mut T)) -> boolwhere
T: VarMapValue,
Updates the value at var_name in place when supported for T.
Returns false if var_name is missing, the stored type is not T, or T does not support
in-place updates (see VarMapValue::update).
Sourcepub fn get<'a, V>(
&'a self,
var_name: &str,
) -> Option<<V as VarMapValue>::Decoded<'a>>where
V: VarMapValue,
pub fn get<'a, V>(
&'a self,
var_name: &str,
) -> Option<<V as VarMapValue>::Decoded<'a>>where
V: VarMapValue,
Returns the value for var_name decoded as V.
Returns None if the name is missing or the stored type does not match V.
Sourcepub fn get_bool(&self, var_name: &str) -> Option<bool>
pub fn get_bool(&self, var_name: &str) -> Option<bool>
Returns the value as bool. See Self::get.
Sourcepub fn get_str(&self, var_name: &str) -> Option<&str>
pub fn get_str(&self, var_name: &str) -> Option<&str>
Returns the value as &str. See Self::get.
Sourcepub fn get_bytes(&self, var_name: &str) -> Option<&[u8]>
pub fn get_bytes(&self, var_name: &str) -> Option<&[u8]>
Returns the value as &[u8]. See Self::get.
Sourcepub fn get_char(&self, var_name: &str) -> Option<char>
pub fn get_char(&self, var_name: &str) -> Option<char>
Returns the value as char. See Self::get.
Sourcepub fn get_ip(&self, var_name: &str) -> Option<IpAddr>
pub fn get_ip(&self, var_name: &str) -> Option<IpAddr>
Returns the value as IpAddr. See Self::get.
Sourcepub fn get_ipv4(&self, var_name: &str) -> Option<Ipv4Addr>
pub fn get_ipv4(&self, var_name: &str) -> Option<Ipv4Addr>
Returns the value as Ipv4Addr. See Self::get.
Sourcepub fn get_ipv6(&self, var_name: &str) -> Option<Ipv6Addr>
pub fn get_ipv6(&self, var_name: &str) -> Option<Ipv6Addr>
Returns the value as Ipv6Addr. See Self::get.
Sourcepub fn contains(&self, var_name: &str) -> bool
pub fn contains(&self, var_name: &str) -> bool
Returns true if var_name has a value (any type).
Sourcepub fn allocated_size(&self) -> usize
pub fn allocated_size(&self) -> usize
Returns the total allocated size of the map.