Skip to main content

Metadata

Struct Metadata 

Source
pub struct Metadata<N, K, L, W, WV, A, AV>
where N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,
{ pub id: Uuid, pub name: Option<N>, pub kind: Option<K>, pub labels: BTreeSet<L>, pub weights: BTreeMap<W, WV>, pub annotations: BTreeMap<A, AV>, }
Expand description

Metadata for any object.

Fields§

§id: Uuid

Instance identifier. Defaults to a randomly generated UUIDv4.

§name: Option<N>

Name associated with this instance.

§kind: Option<K>

Kind of object or main category associated with this instance.

§labels: BTreeSet<L>

Set of labels associated with this instance.

§weights: BTreeMap<W, WV>

Numerical weights associated with this instance.

§annotations: BTreeMap<A, AV>

Free-form annotations associated with this instance.

Implementations§

Source§

impl<N, K, L, W, WV, A, AV> Metadata<N, K, L, W, WV, A, AV>
where N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source

pub fn builder() -> MetadataBuilder<N, K, L, W, WV, A, AV>

Create an instance of Metadata using the builder syntax

Source§

impl<N, K, L, W, WV, A, AV> Metadata<N, K, L, W, WV, A, AV>
where N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source

pub fn as_replace_transaction(self) -> Transaction<N, K, L, W, WV, A, AV>

Creates a “replace” transaction from this metadata.

Source

pub fn as_append_transaction(self) -> Transaction<N, K, L, W, WV, A, AV>

Creates an “append” transaction from this metadata.

Source§

impl<N, K, L, W, WV, A, AV> Metadata<N, K, L, W, WV, A, AV>
where N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source

pub fn as_ref<'a>(&'a self) -> MetadataRef<'a, N, K, L, W, WV, A, AV>

Create a metadata reference struct from this instance.

Trait Implementations§

Source§

impl<N, K, L, W, WV, A, AV> Clone for Metadata<N, K, L, W, WV, A, AV>
where N: Field + Clone, K: Field + Clone, L: Field + Clone, W: Field + Clone, WV: WeightValue + Clone, A: Field + Clone, AV: AnnotationValue + Clone,

Source§

fn clone(&self) -> Metadata<N, K, L, W, WV, A, AV>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<N, K, L, W, WV, A, AV> Debug for Metadata<N, K, L, W, WV, A, AV>
where N: Field + Debug, K: Field + Debug, L: Field + Debug, W: Field + Debug, WV: WeightValue + Debug, A: Field + Debug, AV: AnnotationValue + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<N, K, L, W, WV, A, AV> Default for Metadata<N, K, L, W, WV, A, AV>
where N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, N, K, L, W, WV, A, AV> Deserialize<'de> for Metadata<N, K, L, W, WV, A, AV>
where N: Field + Deserialize<'de>, K: Field + Deserialize<'de>, L: Field + Deserialize<'de>, W: Field + Deserialize<'de>, WV: WeightValue + Deserialize<'de>, A: Field + Deserialize<'de>, AV: AnnotationValue + Deserialize<'de>, Metadata<N, K, L, W, WV, A, AV>: Default,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<N, K, L, W, WV, A, AV> PartialEq for Metadata<N, K, L, W, WV, A, AV>

Source§

fn eq(&self, other: &Metadata<N, K, L, W, WV, A, AV>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, N, K, L, W, WV, A, AV> ReadMetadata<'a, N, K, L, W, WV, A, AV> for Metadata<N, K, L, W, WV, A, AV>
where N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Source§

fn id(&'a self) -> &'a Uuid

Get the ID from metadata.
Source§

fn name(&'a self) -> Option<&'a N>

Get the name from metadata.
Source§

fn kind(&'a self) -> Option<&'a K>

Get the kind from metadata.
Source§

fn labels(&'a self) -> impl Iterator<Item = &'a L>
where L: 'a,

Get the labels from metadata.
Source§

fn weights(&'a self) -> impl Iterator<Item = (&'a W, &'a WV)>
where W: 'a, WV: 'a,

Get the weights from metadata.
Source§

fn annotations(&'a self) -> impl Iterator<Item = (&'a A, &'a AV)>
where A: 'a, AV: 'a,

Get the annotations from metadata.
Source§

impl<N, K, L, W, WV, A, AV> Serialize for Metadata<N, K, L, W, WV, A, AV>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<N, K, L, W, WV, A, AV> StructuralPartialEq for Metadata<N, K, L, W, WV, A, AV>
where N: Field, K: Field, L: Field, W: Field, WV: WeightValue, A: Field, AV: AnnotationValue,

Auto Trait Implementations§

§

impl<N, K, L, W, WV, A, AV> Freeze for Metadata<N, K, L, W, WV, A, AV>
where N: Freeze, K: Freeze,

§

impl<N, K, L, W, WV, A, AV> RefUnwindSafe for Metadata<N, K, L, W, WV, A, AV>

§

impl<N, K, L, W, WV, A, AV> Send for Metadata<N, K, L, W, WV, A, AV>
where N: Send, K: Send, W: Send, WV: Send, A: Send, AV: Send, L: Send,

§

impl<N, K, L, W, WV, A, AV> Sync for Metadata<N, K, L, W, WV, A, AV>
where N: Sync, K: Sync, W: Sync, WV: Sync, A: Sync, AV: Sync, L: Sync,

§

impl<N, K, L, W, WV, A, AV> Unpin for Metadata<N, K, L, W, WV, A, AV>
where N: Unpin, K: Unpin,

§

impl<N, K, L, W, WV, A, AV> UnsafeUnpin for Metadata<N, K, L, W, WV, A, AV>
where N: UnsafeUnpin, K: UnsafeUnpin,

§

impl<N, K, L, W, WV, A, AV> UnwindSafe for Metadata<N, K, L, W, WV, A, AV>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AnnotationValue for T
where T: Debug + Clone + PartialEq,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,