pub struct Metadata {
pub provenance: Option<Provenance>,
pub documentation: Option<Documentation>,
pub tags: HashSet<String>,
pub attributes: HashMap<String, String>,
pub version_history: Vec<VersionEntry>,
}Expand description
Rich metadata container for domains and predicates.
This structure captures all metadata associated with a symbol, including its provenance, documentation, tags, and custom attributes.
Fields§
§provenance: Option<Provenance>Provenance information (who, when, where)
documentation: Option<Documentation>Long-form documentation
Tags for categorization and filtering
attributes: HashMap<String, String>Custom key-value attributes
version_history: Vec<VersionEntry>Version history
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn with_provenance(provenance: Provenance) -> Self
pub fn with_provenance(provenance: Provenance) -> Self
Creates metadata with provenance information.
Sourcepub fn remove_tag(&self, tag: &str) -> bool
pub fn remove_tag(&self, tag: &str) -> bool
Removes a tag from this metadata.
Checks if this metadata has all of the given tags.
Sourcepub fn has_any_tag(&self, tags: &[String]) -> bool
pub fn has_any_tag(&self, tags: &[String]) -> bool
Checks if this metadata has any of the given tags.
Sourcepub fn set_attribute(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
)
pub fn set_attribute( &mut self, key: impl Into<String>, value: impl Into<String>, )
Sets a custom attribute.
Sourcepub fn get_attribute(&self, key: &str) -> Option<&str>
pub fn get_attribute(&self, key: &str) -> Option<&str>
Gets a custom attribute by key.
Sourcepub fn remove_attribute(&mut self, key: &str) -> Option<String>
pub fn remove_attribute(&mut self, key: &str) -> Option<String>
Removes a custom attribute.
Sourcepub fn add_version(
&mut self,
version: impl Into<String>,
timestamp: impl Into<String>,
author: impl Into<String>,
changes: impl Into<String>,
)
pub fn add_version( &mut self, version: impl Into<String>, timestamp: impl Into<String>, author: impl Into<String>, changes: impl Into<String>, )
Adds a version entry to the history.
Sourcepub fn latest_version(&self) -> Option<&VersionEntry>
pub fn latest_version(&self) -> Option<&VersionEntry>
Gets the latest version from the history.
Sourcepub fn set_documentation(&mut self, doc: Documentation)
pub fn set_documentation(&mut self, doc: Documentation)
Sets the documentation for this symbol.
Sourcepub fn get_summary(&self) -> Option<&str>
pub fn get_summary(&self) -> Option<&str>
Gets the documentation summary, if available.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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 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