pub struct AnnotationSet { /* private fields */ }Expand description
A deterministic annotation collection.
Implementations§
Source§impl AnnotationSet
impl AnnotationSet
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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§
Source§impl Clone for AnnotationSet
impl Clone for AnnotationSet
Source§fn clone(&self) -> AnnotationSet
fn clone(&self) -> AnnotationSet
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 AnnotationSet
impl Debug for AnnotationSet
Source§impl Default for AnnotationSet
impl Default for AnnotationSet
Source§fn default() -> AnnotationSet
fn default() -> AnnotationSet
Returns the “default value” for a type. Read more
Source§impl PartialEq for AnnotationSet
impl PartialEq for AnnotationSet
Source§fn eq(&self, other: &AnnotationSet) -> bool
fn eq(&self, other: &AnnotationSet) -> bool
Tests for
self and other values to be equal, and is used by ==.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