pub struct Attributes<SS: StringStorage> { /* private fields */ }Expand description
Container for attributes using a specific storage strategy.
Attributes is a key-value store where keys are strings and values are
AttributeValue instances. Each object owns its attributes directly.
Implementations§
Source§impl<SS: StringStorage> Attributes<SS>
impl<SS: StringStorage> Attributes<SS>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new attributes container with space for at least capacity entries.
Sourcepub fn get(&self, key: &str) -> Option<&AttributeValue<SS>>
pub fn get(&self, key: &str) -> Option<&AttributeValue<SS>>
Retrieves a reference to the attribute value associated with the given key.
Sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut AttributeValue<SS>>
pub fn get_mut(&mut self, key: &str) -> Option<&mut AttributeValue<SS>>
Retrieves a mutable reference to the attribute value associated with the given key.
Sourcepub fn insert(
&mut self,
key: SS::String,
value: AttributeValue<SS>,
) -> Option<AttributeValue<SS>>
pub fn insert( &mut self, key: SS::String, value: AttributeValue<SS>, ) -> Option<AttributeValue<SS>>
Inserts an attribute value with the specified key.
If the key already existed, returns the previous value.
Sourcepub fn remove(&mut self, key: &str) -> Option<AttributeValue<SS>>
pub fn remove(&mut self, key: &str) -> Option<AttributeValue<SS>>
Removes an attribute with the specified key.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&SS::String, &AttributeValue<SS>)>
pub fn iter(&self) -> impl Iterator<Item = (&SS::String, &AttributeValue<SS>)>
Returns an iterator over the attributes’ keys and values.
Sourcepub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (&SS::String, &mut AttributeValue<SS>)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&SS::String, &mut AttributeValue<SS>)>
Returns a mutable iterator over the attributes’ keys and values.
Sourcepub fn keys(&self) -> impl Iterator<Item = &SS::String>
pub fn keys(&self) -> impl Iterator<Item = &SS::String>
Returns an iterator over the attribute keys.
Sourcepub fn values(&self) -> impl Iterator<Item = &AttributeValue<SS>>
pub fn values(&self) -> impl Iterator<Item = &AttributeValue<SS>>
Returns an iterator over the attribute values.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Checks if the attributes container contains a key.
Trait Implementations§
Source§impl<SS: Clone + StringStorage> Clone for Attributes<SS>
impl<SS: Clone + StringStorage> Clone for Attributes<SS>
Source§fn clone(&self) -> Attributes<SS>
fn clone(&self) -> Attributes<SS>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more