pub enum TypeKind {
Show 23 variants
Bool,
I8,
I16,
I32,
I64,
I128,
U8,
U16,
U32,
U64,
U128,
F32,
F64,
Char,
String,
Unit,
Option(Box<TypeKind>),
List(Box<TypeKind>),
Map {
key: Box<TypeKind>,
value: Box<TypeKind>,
},
Tuple(Vec<TypeKind>),
Struct {
fields: Vec<Field>,
},
Enum {
variants: Vec<Variant>,
},
TypeRef(String),
}Expand description
Represents all possible Rust types that can be serialized to RON.
§Trait-Based Design
This enum works alongside the trait system in crate::traits:
Listrepresents any type implementingRonList(Vec,VecDeque, custom types)Maprepresents any type implementingRonMap(HashMap,BTreeMap, custom types)
Custom types implementing these traits will serialize to the same TypeKind
variants, allowing the validation and LSP systems to work uniformly.
Variants§
Bool
I8
I16
I32
I64
I128
U8
U16
U32
U64
U128
F32
F64
Char
String
Unit
Option(Box<TypeKind>)
List(Box<TypeKind>)
List/sequence type - represents any type implementing RonList.
This includes Vec<T>, VecDeque<T>, HashSet<T>, BTreeSet<T>,
arrays, and any custom types implementing RonList.
Map
Map/dictionary type - represents any type implementing RonMap.
This includes HashMap<K, V>, BTreeMap<K, V>, and any custom types
implementing RonMap.
Tuple(Vec<TypeKind>)
Struct
Enum
TypeRef(String)
Reference to another schema by fully-qualified type path.
Implementations§
Source§impl TypeKind
impl TypeKind
Sourcepub fn inner_type(&self) -> Option<&TypeKind>
pub fn inner_type(&self) -> Option<&TypeKind>
Get inner type for Option or List.
Sourcepub fn tuple_types(&self) -> Option<&[TypeKind]>
pub fn tuple_types(&self) -> Option<&[TypeKind]>
Get tuple element types.
Sourcepub fn struct_fields(&self) -> Option<&[Field]>
pub fn struct_fields(&self) -> Option<&[Field]>
Get struct fields.
Sourcepub fn enum_variants(&self) -> Option<&[Variant]>
pub fn enum_variants(&self) -> Option<&[Variant]>
Get enum variants.
Sourcepub fn type_ref_path(&self) -> Option<&str>
pub fn type_ref_path(&self) -> Option<&str>
Get TypeRef path.
Sourcepub fn is_primitive(&self) -> bool
pub fn is_primitive(&self) -> bool
Check if this is a primitive type (no nested types).