pub struct ExtensionCollection { /* private fields */ }Expand description
Collection of extension attributes grouped by schema URI.
This provides an organized way to manage multiple extension attributes and ensures that attributes are properly namespaced by their schema URIs.
Implementations§
Source§impl ExtensionCollection
impl ExtensionCollection
Sourcepub fn add_attribute(&mut self, attribute: ExtensionAttributeValue)
pub fn add_attribute(&mut self, attribute: ExtensionAttributeValue)
Add an extension attribute to the collection.
Sourcepub fn get_by_schema(
&self,
schema_uri: &str,
) -> Option<&Vec<ExtensionAttributeValue>>
pub fn get_by_schema( &self, schema_uri: &str, ) -> Option<&Vec<ExtensionAttributeValue>>
Get all extension attributes for a specific schema URI.
Sourcepub fn get_attribute(
&self,
schema_uri: &str,
attribute_name: &str,
) -> Option<&ExtensionAttributeValue>
pub fn get_attribute( &self, schema_uri: &str, attribute_name: &str, ) -> Option<&ExtensionAttributeValue>
Get a specific extension attribute by schema URI and attribute name.
Sourcepub fn schema_uris(&self) -> Vec<&str>
pub fn schema_uris(&self) -> Vec<&str>
Get all schema URIs that have extensions in this collection.
Sourcepub fn all_attributes(&self) -> Vec<&ExtensionAttributeValue>
pub fn all_attributes(&self) -> Vec<&ExtensionAttributeValue>
Get all extension attributes across all schemas.
Sourcepub fn remove_schema(
&mut self,
schema_uri: &str,
) -> Option<Vec<ExtensionAttributeValue>>
pub fn remove_schema( &mut self, schema_uri: &str, ) -> Option<Vec<ExtensionAttributeValue>>
Remove all extensions for a specific schema URI.
Sourcepub fn validate_all(&self) -> ValidationResult<()>
pub fn validate_all(&self) -> ValidationResult<()>
Validate all extension attributes in the collection.
Sourcepub fn to_json(&self) -> ValidationResult<Value>
pub fn to_json(&self) -> ValidationResult<Value>
Convert the extension collection to a JSON object.
The resulting JSON object has schema URIs as keys and objects containing the extension attributes as values.
Sourcepub fn from_json(value: &Value) -> ValidationResult<Self>
pub fn from_json(value: &Value) -> ValidationResult<Self>
Create an extension collection from a JSON object.
The JSON object should have schema URIs as keys and objects containing extension attributes as values.
Trait Implementations§
Source§impl Clone for ExtensionCollection
impl Clone for ExtensionCollection
Source§fn clone(&self) -> ExtensionCollection
fn clone(&self) -> ExtensionCollection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExtensionCollection
impl Debug for ExtensionCollection
Source§impl Default for ExtensionCollection
impl Default for ExtensionCollection
Source§impl<'de> Deserialize<'de> for ExtensionCollection
impl<'de> Deserialize<'de> for ExtensionCollection
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>,
Auto Trait Implementations§
impl Freeze for ExtensionCollection
impl RefUnwindSafe for ExtensionCollection
impl Send for ExtensionCollection
impl Sync for ExtensionCollection
impl Unpin for ExtensionCollection
impl UnwindSafe for ExtensionCollection
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more