pub struct Metadata { /* private fields */ }Expand description
Represents metadata for a page or content item.
§Example
use metadata_gen::Metadata;
use std::collections::HashMap;
let mut data = HashMap::new();
data.insert("title".to_string(), "My Page".to_string());
let metadata = Metadata::new(data);
assert_eq!(metadata.get("title"), Some(&"My Page".to_string()));Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn new(data: MetadataMap) -> Self
pub fn new(data: MetadataMap) -> Self
Creates a new Metadata instance with the given data.
§Arguments
data- AMetadataMapcontaining the metadata key-value pairs.
§Returns
A new Metadata instance.
Sourcepub fn contains_key(&self, key: &str) -> bool
pub fn contains_key(&self, key: &str) -> bool
Sourcepub fn into_inner(self) -> MetadataMap
pub fn into_inner(self) -> MetadataMap
Consumes the Metadata instance and returns the inner map.
§Returns
The inner MetadataMap containing all metadata key-value pairs.
Trait Implementations§
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