pub struct ContextMap { /* private fields */ }Expand description
String-keyed map of typed context values.
Implementations§
Source§impl ContextMap
impl ContextMap
pub fn new() -> Self
pub fn set_bool(&mut self, key: &str, val: bool)
pub fn set_int(&mut self, key: &str, val: i64)
pub fn set_float(&mut self, key: &str, val: f32)
pub fn set_str(&mut self, key: &str, val: &str)
pub fn set_bytes(&mut self, key: &str, val: Vec<u8>)
pub fn get(&self, key: &str) -> Option<&CtxValue>
pub fn get_bool(&self, key: &str) -> Option<bool>
pub fn get_int(&self, key: &str) -> Option<i64>
pub fn get_float(&self, key: &str) -> Option<f32>
pub fn get_str(&self, key: &str) -> Option<&str>
pub fn contains(&self, key: &str) -> bool
pub fn remove(&mut self, key: &str) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn keys(&self) -> Vec<&str>
pub fn clear(&mut self)
Sourcepub fn merge(&mut self, other: &ContextMap)
pub fn merge(&mut self, other: &ContextMap)
Merge another map into self; other’s values win on conflict.
Trait Implementations§
Source§impl Clone for ContextMap
impl Clone for ContextMap
Source§fn clone(&self) -> ContextMap
fn clone(&self) -> ContextMap
Returns a duplicate 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 ContextMap
impl Debug for ContextMap
Source§impl Default for ContextMap
impl Default for ContextMap
Source§fn default() -> ContextMap
fn default() -> ContextMap
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextMap
impl RefUnwindSafe for ContextMap
impl Send for ContextMap
impl Sync for ContextMap
impl Unpin for ContextMap
impl UnsafeUnpin for ContextMap
impl UnwindSafe for ContextMap
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