Struct bones_framework::asset::SchemaRefMut

source ·
pub struct SchemaRefMut<'pointer> { /* private fields */ }
Expand description

An untyped mutable reference that knows the [Schema] of the pointee and that can be cast to a matching type.

Implementations§

source§

impl<'pointer> SchemaRefMut<'pointer>

source

pub unsafe fn cast_mut_unchecked<T>(&mut self) -> &mut T

Cast this pointer to a mutable reference.

§Safety

You must uphold all safety requirements of NonNull::as_mut().

source

pub unsafe fn cast_into_mut_unchecked<T>(self) -> &'pointer mut T

Cast this pointer to a mutable reference.

§Safety

You must uphold all safety requirements of NonNull::as_mut().

source

pub fn cast_mut<T>(&mut self) -> &mut T
where T: HasSchema + 'static,

Cast this pointer to a reference to a type with a matching [Schema].

§Panics

Panics if the schema of the pointer does not match that of the type you are casting to.

source

pub fn try_cast_mut<T>(&mut self) -> Result<&mut T, SchemaMismatchError>
where T: HasSchema,

Cast this pointer to a mutable reference to a type with a matching [Schema].

§Errors

Errors if the schema of the pointer does not match that of the type you are casting to.

source

pub fn cast_into_mut<T>(self) -> &'pointer mut T
where T: HasSchema,

Cast this pointer to a mutable reference to a type with a matching [Schema]. This is different than try_cast because it consumes the SchemaRefMut and allows you to, for instance, pass it out of a mapping operation without keeping a reference to the old SchemaRefMut.

§Panics

Panics if the schema of the pointer does not match that of the type you are casting to.

source

pub fn try_cast_into_mut<T>( self, ) -> Result<&'pointer mut T, SchemaMismatchError>
where T: HasSchema,

Cast this pointer to a mutable reference to a type with a matching [Schema]. This is different than try_cast because it consumes the SchemaRefMut and allows you to, for instance, pass it out of a mapping operation without keeping a reference to the old SchemaRefMut.

§Errors

Errors if the schema of the pointer does not match that of the type you are casting to.

source

pub fn new<T>(v: &'pointer mut T) -> SchemaRefMut<'pointer>
where T: HasSchema,

Create a new SchemaRefMut from a reference to a type that implements HasSchema.

source

pub unsafe fn from_ptr_schema( ptr: *mut c_void, schema: &'static Schema, ) -> SchemaRefMut<'pointer>

Create a new SchemaRefMut from a raw pointer and it’s schema.

§Safety
  • The pointee of ptr must be accurately described by the given schema.
  • inner must have correct provenance to allow reads and writes of the pointee type.
  • The pointer must be valid for the full lifetime of this SchemaRef.
source

pub fn into_map(self) -> Result<&'pointer mut SchemaMap, SchemaRefMut<'pointer>>

Borrow the schema ref as a SchemaMap if it is one.

source

pub fn into_vec(self) -> Result<&'pointer mut SchemaVec, SchemaRefMut<'pointer>>

Borrow the schema ref as a SchemaVec if it is one.

source

pub fn into_box(self) -> Result<SchemaRefMut<'pointer>, SchemaRefMut<'pointer>>

Borrow the schema ref as a SchemaBox if it is one.

source

pub fn into_access_mut(self) -> SchemaRefMutAccess<'pointer>

Convert into an accessor for the inner data.

source

pub fn access_mut(&mut self) -> SchemaRefMutAccess<'_>

Get a mutable access helper to this reference.

source

pub fn as_ptr(&self) -> *mut c_void

Get the raw pointer

source

pub fn schema(&self) -> &'static Schema

Get the [Schema] for the pointer.

source

pub fn hash(&self) -> Option<u64>

Get the hash of this schema box, if supported.

source

pub fn as_ref(&self) -> SchemaRef<'_>

Borrow this SchemaRefMut as a SchemaRef.

source

pub fn reborrow(&mut self) -> SchemaRefMut<'_>

Convert a borrowed SchemaRefMut to an owned SchemaRefMut with a lifetime matching That of the borrow.

source

pub fn field<'a, I>(&mut self, field_idx: I) -> Option<SchemaRefMut<'_>>
where I: Into<FieldIdx<'a>>,

Get the reference to a field.

source

pub fn field_path<'a, I>(&mut self, path: I) -> Option<SchemaRefMut<'_>>
where I: IntoIterator<Item = FieldIdx<'a>>,

Get the field pointed to by the given path.

source

pub fn into_field_path<'a, I>(self, path: I) -> Option<SchemaRefMut<'pointer>>
where I: IntoIterator<Item = FieldIdx<'a>>,

Get the field pointed to by the given path.

source

pub fn into_field<'a, I>( self, field_idx: I, ) -> Result<SchemaRefMut<'pointer>, SchemaRefMut<'pointer>>
where I: Into<FieldIdx<'a>>,

Get the reference to a field.

source

pub fn write(&mut self, other: SchemaRef<'_>) -> Result<(), SchemaMismatchError>

Clone other and write it’s data to self. Panics if this schema doesn’t support cloning.

Trait Implementations§

source§

impl<'pointer> Debug for SchemaRefMut<'pointer>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'a, 'de> DeserializeSeed<'de> for SchemaRefMut<'a>

§

type Value = ()

The type produced by using this seed.
source§

fn deserialize<D>( self, deserializer: D, ) -> Result<<SchemaRefMut<'a> as DeserializeSeed<'de>>::Value, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Equivalent to the more common Deserialize::deserialize method, except with some initial piece of data (the seed) passed in.
source§

impl<'a> From<SchemaRefMut<'a>> for PrimitiveRefMut<'a>

source§

fn from(value: SchemaRefMut<'a>) -> PrimitiveRefMut<'a>

Converts to this type from the input type.
source§

impl MetatableFn for SchemaRefMut<'_>

source§

fn metatable_fn(&self) -> fn(_: Context<'_>) -> Table<'_>

Auto Trait Implementations§

§

impl<'pointer> Freeze for SchemaRefMut<'pointer>

§

impl<'pointer> !RefUnwindSafe for SchemaRefMut<'pointer>

§

impl<'pointer> !Send for SchemaRefMut<'pointer>

§

impl<'pointer> !Sync for SchemaRefMut<'pointer>

§

impl<'pointer> Unpin for SchemaRefMut<'pointer>

§

impl<'pointer> !UnwindSafe for SchemaRefMut<'pointer>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
source§

impl<T> RawDrop for T

source§

unsafe fn raw_drop(ptr: *mut c_void)

Write the default value of the type to the pointer. Read more
source§

fn raw_drop_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,