Enum Kind

Source
#[non_exhaustive]
pub enum Kind<Metadata: Default> {
Show 23 variants Struct { name: &'static str, children: Vec<Entry<Metadata>>, }, Aliased { name: &'static str, kind: Box<Descriptor<Metadata>>, }, Enum { name: &'static str, variants: Vec<Variant<Metadata>>, }, Sequence(Box<Descriptor<Metadata>>), Option(Box<Descriptor<Metadata>>), Mapping(Box<Descriptor<Metadata>>, Box<Descriptor<Metadata>>), DateTime, String, U128, I128, U64, I64, U32, I32, U16, I16, U8, I8, F64, F32, Bool, JSON, Any,
}
Expand description

Enum reflecting all supported types

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Struct

The type is a struct

Fields

§name: &'static str

Name given to the struct in its declaration

§children: Vec<Entry<Metadata>>

List of fields within this struct

§

Aliased

A struct wrapping a single anonymous field

Fields

§name: &'static str

Name given to the struct in its declaration

§kind: Box<Descriptor<Metadata>>

The type this alias struct wraps

§

Enum

A simple no-field enum type

Fields

§name: &'static str

Name given to the enum in its declaration

§variants: Vec<Variant<Metadata>>

Information about each variant value within this enum

§

Sequence(Box<Descriptor<Metadata>>)

A list of items of a consistent type

§

Option(Box<Descriptor<Metadata>>)

An item which is optionally present

§

Mapping(Box<Descriptor<Metadata>>, Box<Descriptor<Metadata>>)

A pairwise mapping between consistent types with unique keys

§

DateTime

A field describing a point in time

§

String

A string

§

U128

Unsigned 128 bit integer

§

I128

Signed 128 bit integer

§

U64

Unsigned 64 bit integer

§

I64

Signed 64 bit integer

§

U32

Unsigned 32 bit integer

§

I32

Signed 32 bit integer

§

U16

Unsigned 16 bit integer

§

I16

Signed 16 bit integer

§

U8

Unsigned 8 bit integer

§

I8

Signed 8 bit integer

§

F64

64 bit floating point number

§

F32

32 bit floating point number

§

Bool

A boolean value

§

JSON

A value of unspecified type, that must be limited to json

§

Any

A value of unspecified type

Implementations§

Source§

impl<Metadata: MetadataKind> Kind<Metadata>

Source

pub fn name(&self) -> &'static str

Fetch the name of the type

Source

pub fn new_struct( name: &'static str, children: Vec<Entry<Metadata>>, flattened_children: &mut [Descriptor<Metadata>], flattened_metadata: &mut [Metadata], ) -> Self

Construct a type descriptor for a struct with the given name and fields.

Any structs in the flattened_children list will have their fields added to this new struct as if they were members of it. (this corresponds to the ‘flatten’ parameter in serde)

Trait Implementations§

Source§

impl<Metadata: Clone + Default> Clone for Kind<Metadata>

Source§

fn clone(&self) -> Kind<Metadata>

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<Metadata: Debug + Default> Debug for Kind<Metadata>

Source§

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

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

impl<Metadata: PartialEq + Default> PartialEq for Kind<Metadata>

Source§

fn eq(&self, other: &Kind<Metadata>) -> 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<Metadata: Eq + Default> Eq for Kind<Metadata>

Source§

impl<Metadata: Default> StructuralPartialEq for Kind<Metadata>

Auto Trait Implementations§

§

impl<Metadata> Freeze for Kind<Metadata>

§

impl<Metadata> RefUnwindSafe for Kind<Metadata>
where Metadata: RefUnwindSafe,

§

impl<Metadata> Send for Kind<Metadata>
where Metadata: Send,

§

impl<Metadata> Sync for Kind<Metadata>
where Metadata: Sync,

§

impl<Metadata> Unpin for Kind<Metadata>
where Metadata: Unpin,

§

impl<Metadata> UnwindSafe for Kind<Metadata>
where Metadata: UnwindSafe,

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.