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§

§

impl<'pointer> SchemaRefMut<'pointer>

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().

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().

pub fn cast_mut<T>(&mut self) -> &mut Twhere 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.

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.

pub fn cast_into_mut<T>(self) -> &'pointer mut Twhere 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.

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.

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.

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.

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

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

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

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

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

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

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

Convert into an accessor for the inner data.

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

Get a mutable access helper to this reference.

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

Get the raw pointer

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

Get the [Schema] for the pointer.

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

Get the hash of this schema box, if supported.

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

Borrow this SchemaRefMut as a SchemaRef.

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

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

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

Get the reference to a field.

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.

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.

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.

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§

§

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

§

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

Formats the value using the given formatter. Read more
§

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

§

type Value = ()

The type produced by using this seed.
§

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.
§

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

§

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

Converts to this type from the input type.

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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 Twhere 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<T> RawDrop for T

§

unsafe fn raw_drop(ptr: *mut c_void)

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

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
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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 Twhere 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