pub struct Metadata { /* private fields */ }Expand description
Typed metadata map validated against a MetadataSchema.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn new(schema: &MetadataSchema) -> Self
pub fn new(schema: &MetadataSchema) -> Self
Creates metadata map with every core key pre-populated as None.
Sourcepub fn get(&self, key: &str) -> Option<&MetadataValue>
pub fn get(&self, key: &str) -> Option<&MetadataValue>
Returns metadata value by key.
Sourcepub fn clear(&mut self, schema: &MetadataSchema, key: &str) -> Result<()>
pub fn clear(&mut self, schema: &MetadataSchema, key: &str) -> Result<()>
Clears registered metadata key by writing None.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &MetadataValue)> + '_
pub fn iter(&self) -> impl Iterator<Item = (&str, &MetadataValue)> + '_
Iterates metadata entries in deterministic key order.
Sourcepub fn set(
&mut self,
schema: &MetadataSchema,
key: &str,
value: MetadataValue,
) -> Result<()>
pub fn set( &mut self, schema: &MetadataSchema, key: &str, value: MetadataValue, ) -> Result<()>
Writes metadata value after registration and type validation.
Trait Implementations§
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
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