pub struct AttributeBag { /* private fields */ }Expand description
Flat key→value namespace consumed by the evaluator.
Populate via set() and/or AttributeExtractor::extract(); query via
the typed get_* methods. Once handed to the evaluator the bag is
read-only by convention (not enforced — &mut borrows are how you
build it up in the first place).
Implementations§
Source§impl AttributeBag
impl AttributeBag
pub fn new() -> Self
pub fn set(&mut self, key: impl Into<String>, value: impl Into<AttributeValue>)
pub fn get(&self, key: &str) -> Option<&AttributeValue>
pub fn contains(&self, key: &str) -> bool
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<f64>
pub fn get_string(&self, key: &str) -> Option<&str>
pub fn get_string_set(&self, key: &str) -> Option<&HashSet<String>>
Sourcepub fn set_contains(&self, key: &str, value: &str) -> bool
pub fn set_contains(&self, key: &str, value: &str) -> bool
DSL <key> contains <value> — false if the key is missing or not a set.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = (&str, &AttributeValue)>
Trait Implementations§
Source§impl Clone for AttributeBag
impl Clone for AttributeBag
Source§fn clone(&self) -> AttributeBag
fn clone(&self) -> AttributeBag
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 AttributeBag
impl Debug for AttributeBag
Source§impl Default for AttributeBag
impl Default for AttributeBag
Source§fn default() -> AttributeBag
fn default() -> AttributeBag
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AttributeBag
impl<'de> Deserialize<'de> for AttributeBag
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 AttributeBag
impl RefUnwindSafe for AttributeBag
impl Send for AttributeBag
impl Sync for AttributeBag
impl Unpin for AttributeBag
impl UnsafeUnpin for AttributeBag
impl UnwindSafe for AttributeBag
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