#[repr(u8)]pub enum SchemaKind<Id = SchemaHash> {
Struct {
name: String,
fields: Vec<FieldSchema<Id>>,
},
Enum {
name: String,
variants: Vec<VariantSchema<Id>>,
},
Tuple {
elements: Vec<TypeRef<Id>>,
},
List {
element: TypeRef<Id>,
},
Map {
key: TypeRef<Id>,
value: TypeRef<Id>,
},
Array {
element: TypeRef<Id>,
length: u64,
},
Option {
element: TypeRef<Id>,
},
Channel {
direction: ChannelDirection,
element: TypeRef<Id>,
},
Primitive {
primitive_type: PrimitiveType,
},
}Expand description
The structural kind of a type, generic over the ID representation.
Variants§
Struct
Fields
§
name: StringThe type name (e.g. “Point”). Used for matching across schema versions and for diagnostics. MUST NOT be empty.
§
fields: Vec<FieldSchema<Id>>Enum
Fields
§
name: StringThe type name (e.g. “Color”). Used for matching across schema versions and for diagnostics. MUST NOT be empty.
§
variants: Vec<VariantSchema<Id>>Tuple
List
Map
Array
Option
Channel
Primitive
Fields
§
primitive_type: PrimitiveTypeImplementations§
Source§impl<Id> SchemaKind<Id>
impl<Id> SchemaKind<Id>
Sourcepub fn for_each_type_ref(&self, f: &mut impl FnMut(&TypeRef<Id>))
pub fn for_each_type_ref(&self, f: &mut impl FnMut(&TypeRef<Id>))
Visit every TypeRef in this schema kind.
Sourcepub fn try_map_type_refs<OtherId, E>(
self,
f: &mut impl FnMut(TypeRef<Id>) -> Result<TypeRef<OtherId>, E>,
) -> Result<SchemaKind<OtherId>, E>
pub fn try_map_type_refs<OtherId, E>( self, f: &mut impl FnMut(TypeRef<Id>) -> Result<TypeRef<OtherId>, E>, ) -> Result<SchemaKind<OtherId>, E>
Transform every TypeRef in this schema kind, with fallible mapping.
Trait Implementations§
Source§impl<Id> Clone for SchemaKind<Id>where
Id: Clone,
impl<Id> Clone for SchemaKind<Id>where
Id: Clone,
Source§fn clone(&self) -> SchemaKind<Id>
fn clone(&self) -> SchemaKind<Id>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Id> Debug for SchemaKind<Id>where
Id: Debug,
impl<Id> Debug for SchemaKind<Id>where
Id: Debug,
Auto Trait Implementations§
impl<Id> Freeze for SchemaKind<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for SchemaKind<Id>where
Id: RefUnwindSafe,
impl<Id> Send for SchemaKind<Id>where
Id: Send,
impl<Id> Sync for SchemaKind<Id>where
Id: Sync,
impl<Id> Unpin for SchemaKind<Id>where
Id: Unpin,
impl<Id> UnsafeUnpin for SchemaKind<Id>where
Id: UnsafeUnpin,
impl<Id> UnwindSafe for SchemaKind<Id>where
Id: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more