Struct AnnotationSet
pub struct AnnotationSet { /* private fields */ }Expand description
A deterministic annotation collection.
Implementations§
§impl AnnotationSet
impl AnnotationSet
pub const fn new() -> AnnotationSet
pub const fn new() -> AnnotationSet
Creates an empty annotation set.
pub fn insert(&mut self, annotation: Annotation) -> Option<AnnotationValue>
pub fn insert(&mut self, annotation: Annotation) -> Option<AnnotationValue>
Inserts an annotation and returns the previous value for the key, if any.
pub fn insert_pair(
&mut self,
key: impl AsRef<str>,
value: impl Into<AnnotationValue>,
) -> Result<Option<AnnotationValue>, AnnotationKeyError>
pub fn insert_pair( &mut self, key: impl AsRef<str>, value: impl Into<AnnotationValue>, ) -> Result<Option<AnnotationValue>, AnnotationKeyError>
Inserts a key-value pair and returns the previous value for the key, if any.
§Errors
Returns AnnotationKeyError::Empty when the key is empty.
pub fn get(&self, key: impl AsRef<str>) -> Option<&AnnotationValue>
pub fn get(&self, key: impl AsRef<str>) -> Option<&AnnotationValue>
Gets a value by key text.
pub fn remove(&mut self, key: impl AsRef<str>) -> Option<AnnotationValue>
pub fn remove(&mut self, key: impl AsRef<str>) -> Option<AnnotationValue>
Removes a value by key text.
pub fn iter(&self) -> impl Iterator<Item = (&AnnotationKey, &AnnotationValue)>
pub fn iter(&self) -> impl Iterator<Item = (&AnnotationKey, &AnnotationValue)>
Iterates annotations in deterministic key order.
Trait Implementations§
§impl Clone for AnnotationSet
impl Clone for AnnotationSet
§fn clone(&self) -> AnnotationSet
fn clone(&self) -> AnnotationSet
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 more§impl Debug for AnnotationSet
impl Debug for AnnotationSet
§impl Default for AnnotationSet
impl Default for AnnotationSet
§fn default() -> AnnotationSet
fn default() -> AnnotationSet
Returns the “default value” for a type. Read more
§impl PartialEq for AnnotationSet
impl PartialEq for AnnotationSet
impl Eq for AnnotationSet
impl StructuralPartialEq for AnnotationSet
Auto Trait Implementations§
impl Freeze for AnnotationSet
impl RefUnwindSafe for AnnotationSet
impl Send for AnnotationSet
impl Sync for AnnotationSet
impl Unpin for AnnotationSet
impl UnsafeUnpin for AnnotationSet
impl UnwindSafe for AnnotationSet
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