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.
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
Tuple
A tuple of multiple types.
The length of Type::Tuple::values is the number of elements in the tuple.
Union
A union of multiple types.
Fields
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
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.