Enum bones_schema::SchemaKind
source · pub enum SchemaKind {
Struct(StructSchemaInfo),
Vec(&'static Schema),
Enum(EnumSchemaInfo),
Map {
key: &'static Schema,
value: &'static Schema,
},
Box(&'static Schema),
Primitive(Primitive),
}
Expand description
A schema describes the data layout of a type, to enable dynamic access to the type’s data through a pointer.
Variants§
Struct(StructSchemaInfo)
The type represents a struct.
Vec(&'static Schema)
Type represents a SchemaVec
, where each item in the vec has the contained Schema
.
The scripting solution must facilitate a way for scripts to access data in the Vec
if it
is to be readable/modifyable from scripts.
Enum(EnumSchemaInfo)
Type represents an enum, which in the C layout is called a tagged union.
Map
Type represents a SchemaMap
.
Fields
Box(&'static Schema)
The represents a SchemaBox
with given type inside.
Primitive(Primitive)
The type represents a primitive value.
Implementations§
source§impl SchemaKind
impl SchemaKind
sourcepub fn as_primitive(&self) -> Option<&Primitive>
pub fn as_primitive(&self) -> Option<&Primitive>
Get the primitive, if this is a primitive.
sourcepub fn as_struct(&self) -> Option<&StructSchemaInfo>
pub fn as_struct(&self) -> Option<&StructSchemaInfo>
Get the struct, if this is a struct.
sourcepub fn as_enum(&self) -> Option<&EnumSchemaInfo>
pub fn as_enum(&self) -> Option<&EnumSchemaInfo>
Get the enum, if this is a enum.
source§impl SchemaKind
impl SchemaKind
sourcepub fn compute_layout_info(&self) -> SchemaLayoutInfo<'_>
pub fn compute_layout_info(&self) -> SchemaLayoutInfo<'_>
Calculate the layout of the type represented by the schema.
Usually you don’t need to call this and should use the static, cached layout and field
offsets from Schema::layout()
and Schema::field_offsets()
.
sourcepub fn has_opaque(&self) -> bool
pub fn has_opaque(&self) -> bool
Recursively checks whether or not the schema contains any Opaque
primitives.
Trait Implementations§
source§impl Clone for SchemaKind
impl Clone for SchemaKind
source§fn clone(&self) -> SchemaKind
fn clone(&self) -> SchemaKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for SchemaKind
impl !RefUnwindSafe for SchemaKind
impl Send for SchemaKind
impl Sync for SchemaKind
impl Unpin for SchemaKind
impl !UnwindSafe for SchemaKind
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)