pub struct Metadata { /* private fields */ }
Expand description
Metadata with a name and optional configuration.
Can be deserialised from a JSON string or name/configuration map. For example:
"bytes"
or
{
"name": "bytes",
}
or
{
"name": "bytes",
"configuration": {
"endian": "little"
}
}
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn new_with_configuration(
name: &str,
configuration: MetadataConfiguration
) -> Self
pub fn new_with_configuration( name: &str, configuration: MetadataConfiguration ) -> Self
Create metadata from name
and configuration
.
sourcepub fn new_with_serializable_configuration<TConfiguration: Serialize>(
name: &str,
configuration: &TConfiguration
) -> Result<Self, Error>
pub fn new_with_serializable_configuration<TConfiguration: Serialize>( name: &str, configuration: &TConfiguration ) -> Result<Self, Error>
Convert a serializable configuration to Metadata
.
§Errors
Returns serde_json::Error
if configuration
cannot be converted to Metadata
.
sourcepub fn to_configuration<TConfiguration: DeserializeOwned>(
&self
) -> Result<TConfiguration, ConfigurationInvalidError>
pub fn to_configuration<TConfiguration: DeserializeOwned>( &self ) -> Result<TConfiguration, ConfigurationInvalidError>
Try and convert Metadata
to a serializable configuration.
§Errors
Returns a ConfigurationInvalidError
if the metadata cannot be converted.
sourcepub const fn configuration(&self) -> Option<&MetadataConfiguration>
pub const fn configuration(&self) -> Option<&MetadataConfiguration>
Returns the metadata configuration.
sourcepub fn configuration_is_none_or_empty(&self) -> bool
pub fn configuration_is_none_or_empty(&self) -> bool
Returns true if the configuration is none or an empty map.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Metadata
impl PartialEq for Metadata
impl Eq for Metadata
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.