Struct bones_schema::prelude::SchemaData
source · pub struct SchemaData {
pub name: Ustr,
pub full_name: Ustr,
pub kind: SchemaKind,
pub type_data: TypeDatas,
pub type_id: Option<TypeId>,
pub clone_fn: Option<Unsafe<&'static (dyn Fn(*const c_void, *mut c_void) + Sync + Send + 'static)>>,
pub drop_fn: Option<Unsafe<&'static (dyn Fn(*mut c_void) + Sync + Send + 'static)>>,
pub default_fn: Option<Unsafe<&'static (dyn Fn(*mut c_void) + Sync + Send + 'static)>>,
pub hash_fn: Option<Unsafe<&'static (dyn Fn(*const c_void) -> u64 + Sync + Send + 'static)>>,
pub eq_fn: Option<Unsafe<&'static (dyn Fn(*const c_void, *const c_void) -> bool + Sync + Send + 'static)>>,
}
Expand description
Schema information describing the memory layout of a type.
Fields§
§name: Ustr
The short name of the type.
Note: Currently bones isn’t very standardized as far as name generation for Rust or other language type names, and this is mostly for diagnostics. This may change in the future but for now there are no guarantees.
full_name: Ustr
The full name of the type, including any module specifiers.
Note: Currently bones isn’t very standardized as far as name generation for Rust or other language type names, and this is mostly for diagnostics. This may change in the future but for now there are no guarantees.
kind: SchemaKind
The kind of schema.
type_data: TypeDatas
Container for storing Schema
type datas.
“Type data” is extra data that is stored in a type’s Schema
that may be used for any number
of different purposes.
Each type data is a type that implements HasSchema
and usually describes something about the
type that has the schema. For instance, a type data could be added to a struct that can be used
to serialize/deserialize that type.
If a type data also implements FromType
it can be derived for types that it implements
FromType
for:
#[derive(HasSchema, Default, Clone)]
struct SomeTypeData;
impl<T> FromType<T> for SomeTypeData {
fn from_type() -> Self {
SomeTypeData
}
}
#[derive(HasSchema, Default, Clone)]
#[derive_type_data(SomeTypeData)]
struct MyData;
type_id: Option<TypeId>
§clone_fn: Option<Unsafe<&'static (dyn Fn(*const c_void, *mut c_void) + Sync + Send + 'static)>>
The function pointer that may be used to clone data with this schema.
drop_fn: Option<Unsafe<&'static (dyn Fn(*mut c_void) + Sync + Send + 'static)>>
The function pointer that may be used to drop data with this schema.
default_fn: Option<Unsafe<&'static (dyn Fn(*mut c_void) + Sync + Send + 'static)>>
The function pointer that may be used to write a default value to a pointer.
hash_fn: Option<Unsafe<&'static (dyn Fn(*const c_void) -> u64 + Sync + Send + 'static)>>
The function pointer that may be used to hash the value.
eq_fn: Option<Unsafe<&'static (dyn Fn(*const c_void, *const c_void) -> bool + Sync + Send + 'static)>>
The function pointer that may be used to compare two values for equality. Note that this is total equality, not partial equality.
Trait Implementations§
source§impl Clone for SchemaData
impl Clone for SchemaData
source§fn clone(&self) -> SchemaData
fn clone(&self) -> SchemaData
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 SchemaData
impl !RefUnwindSafe for SchemaData
impl Send for SchemaData
impl Sync for SchemaData
impl Unpin for SchemaData
impl !UnwindSafe for SchemaData
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
)