Type

Enum Type 

Source
pub enum Type {
    Array {
        value: Box<Type>,
    },
    Dictionary {
        key: Box<Type>,
        value: Box<Type>,
    },
    Tuple {
        values: Vec<Type>,
    },
    Union {
        options: Vec<Type>,
        full_format: bool,
    },
    Literal(TypeLiteral),
    Type {
        value: Box<Type>,
        description: String,
    },
    Struct,
    Simple(String),
}
Expand description

A type field can be a string (Type::Simple), in which case that string is the simple type. Otherwise, a type is an enum and considered a complex type by the documentation.

The enum variant is determined by the complex_type field in the JSON. Type is internally tagged by the complex_type field, which is only present in the JSON and not in the Rust struct.

Variants§

§

Array

An array of other types.

Fields

§value: Box<Type>

The type of the elements of the array.

§

Dictionary

A mapping of keys to values.

The key is also a Type but usually is a Type::Simple. In turn, those types are usually newtypes over strings.

Fields

§key: Box<Type>

The type of the keys of the dictionary.

§value: Box<Type>

The type of the values of the dictionary.

§

Tuple

A tuple of multiple types.

The length of Type::Tuple::values is the number of elements in the tuple.

Fields

§values: Vec<Type>

The types of the members of this tuple in order.

§

Union

A union of multiple types.

Fields

§options: Vec<Type>

A list of all compatible types for this type.

§full_format: bool

Whether the options of this union have a description or not.

§

Literal(TypeLiteral)

A literal value with an optional description.

§

Type

A type with a description.

This is often used for enums or default values of properties when a description is desired.

Fields

§value: Box<Type>

The actual type.

This format for types is used when they have descriptions attached to them.

§description: String

The text description of the type.

§

Struct

Special type with additional members listed on the API member’s properties that used this complex type.

This includes crate::Prototype::properties and crate::Concept::properties.

§

Simple(String)

The simple type, such as a builtin or a reference to another Type or crate::Concept

This is untagged and so appears as "type: "foo" in the JSON. Typically, concepts have a PascalCase name.

Trait Implementations§

Source§

impl Debug for Type

Source§

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

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

impl<'de> Deserialize<'de> for Type

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 PartialEq for Type

Source§

fn eq(&self, other: &Type) -> 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 Serialize for Type

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 Eq for Type

Source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

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> 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, 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,