Struct bones_schema::ptr::SchemaBox
source · pub struct SchemaBox { /* private fields */ }
Implementations§
source§impl SchemaBox
impl SchemaBox
sourcepub fn cast_into<T: HasSchema>(self) -> T
pub fn cast_into<T: HasSchema>(self) -> T
Cast this box to it’s inner type and return it.
§Panics
Panics if the schema of the box does not match that of the type you are casting to.
sourcepub fn try_cast_into<T: HasSchema>(self) -> Result<T, SchemaMismatchError>
pub fn try_cast_into<T: HasSchema>(self) -> Result<T, SchemaMismatchError>
Cast this box to it’s inner type and return it.
§Errors
Errors if the schema of the box does not match that of the type you are casting to.
sourcepub unsafe fn cast_into_unchecked<T: HasSchema>(self) -> T
pub unsafe fn cast_into_unchecked<T: HasSchema>(self) -> T
Unsafely convert this box into an owned T.
§Safety
- The schema of type T must equal that of this box.
sourcepub fn try_cast_ref<T: HasSchema>(&self) -> Result<&T, SchemaMismatchError>
pub fn try_cast_ref<T: HasSchema>(&self) -> Result<&T, SchemaMismatchError>
sourcepub fn try_cast_mut<T: HasSchema>(
&mut self,
) -> Result<&mut T, SchemaMismatchError>
pub fn try_cast_mut<T: HasSchema>( &mut self, ) -> Result<&mut T, SchemaMismatchError>
sourcepub fn as_mut(&mut self) -> SchemaRefMut<'_>
pub fn as_mut(&mut self) -> SchemaRefMut<'_>
Borrow this box as a SchemaRefMut
.
sourcepub fn new<T: HasSchema + Sync + Send>(v: T) -> Self
pub fn new<T: HasSchema + Sync + Send>(v: T) -> Self
Create a new SchemaBox
from an owned type.
sourcepub unsafe fn uninitialized(schema: &'static Schema) -> Self
pub unsafe fn uninitialized(schema: &'static Schema) -> Self
sourcepub fn default(schema: &'static Schema) -> Self
pub fn default(schema: &'static Schema) -> Self
Create a new SchemaBox
for a type with a Schema
that has a
SchemaData::default_fn
.
§Panics
Panics if the passed in schema doesn’t have a default_fn
.
sourcepub fn try_into_sbox<T: HasSchema>(self) -> Result<SBox<T>, Self>
pub fn try_into_sbox<T: HasSchema>(self) -> Result<SBox<T>, Self>
sourcepub unsafe fn from_raw_parts(
ptr: NonNull<c_void>,
schema: &'static Schema,
) -> Self
pub unsafe fn from_raw_parts( ptr: NonNull<c_void>, schema: &'static Schema, ) -> Self
Trait Implementations§
source§impl HasSchema for SchemaBox
impl HasSchema for SchemaBox
source§fn register_schema()
fn register_schema()
Register this schema with the global schema registry. Read more
source§fn cast<T: HasSchema>(this: &Self) -> &T
fn cast<T: HasSchema>(this: &Self) -> &T
Cast a reference of this type to a reference of another type with the same memory layout. Read more
source§fn try_cast<T: HasSchema>(this: &Self) -> Result<&T, SchemaMismatchError>
fn try_cast<T: HasSchema>(this: &Self) -> Result<&T, SchemaMismatchError>
Cast a reference of this type to a reference of another type with the same memory layout. Read more
source§fn cast_mut<T: HasSchema>(this: &mut Self) -> &mut T
fn cast_mut<T: HasSchema>(this: &mut Self) -> &mut T
Cast a mutable reference of this type to a reference of another type with the same memory
layout. Read more
source§fn try_cast_mut<T: HasSchema>(
this: &mut Self,
) -> Result<&mut T, SchemaMismatchError>
fn try_cast_mut<T: HasSchema>( this: &mut Self, ) -> Result<&mut T, SchemaMismatchError>
Cast a mutable reference of this type to a reference of another type with the same memory
layout. Read more
source§fn as_schema_ref(&self) -> SchemaRef<'_>where
Self: Sized,
fn as_schema_ref(&self) -> SchemaRef<'_>where
Self: Sized,
Converts a reference of
T
to a SchemaRef
source§fn as_schema_mut(&mut self) -> SchemaRefMut<'_>where
Self: Sized,
fn as_schema_mut(&mut self) -> SchemaRefMut<'_>where
Self: Sized,
Converts a reference of
T
to a SchemaRefMut
source§impl PartialEq for SchemaBox
impl PartialEq for SchemaBox
impl Eq for SchemaBox
impl Send for SchemaBox
impl Sync for SchemaBox
Auto Trait Implementations§
impl Freeze for SchemaBox
impl !RefUnwindSafe for SchemaBox
impl Unpin for SchemaBox
impl !UnwindSafe for SchemaBox
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
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more