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>
impl<'pointer> SchemaRefMut<'pointer>
Sourcepub unsafe fn cast_mut_unchecked<T>(&mut self) -> &mut T
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().
Sourcepub unsafe fn cast_into_mut_unchecked<T>(self) -> &'pointer mut T
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().
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 cast_into_mut<T: HasSchema>(self) -> &'pointer mut T
pub fn cast_into_mut<T: HasSchema>(self) -> &'pointer mut T
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.
Sourcepub fn try_cast_into_mut<T: HasSchema>(
self,
) -> Result<&'pointer mut T, SchemaMismatchError>
pub fn try_cast_into_mut<T: HasSchema>( self, ) -> Result<&'pointer mut T, SchemaMismatchError>
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.
Sourcepub fn new<T: HasSchema>(v: &'pointer mut T) -> SchemaRefMut<'pointer>
pub fn new<T: HasSchema>(v: &'pointer mut T) -> SchemaRefMut<'pointer>
Create a new SchemaRefMut from a reference to a type that implements HasSchema.
Sourcepub unsafe fn from_ptr_schema(
ptr: *mut c_void,
schema: &'static Schema,
) -> SchemaRefMut<'pointer>
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
ptrmust be accurately described by the givenschema. innermust have correct provenance to allow reads and writes of the pointee type.- The pointer must be valid for the full lifetime of this
SchemaRef.
Sourcepub fn into_map(self) -> Result<&'pointer mut SchemaMap, Self>
pub fn into_map(self) -> Result<&'pointer mut SchemaMap, Self>
Borrow the schema ref as a SchemaMap if it is one.
Sourcepub fn into_vec(self) -> Result<&'pointer mut SchemaVec, Self>
pub fn into_vec(self) -> Result<&'pointer mut SchemaVec, Self>
Borrow the schema ref as a SchemaVec if it is one.
Sourcepub fn into_box(self) -> Result<SchemaRefMut<'pointer>, Self>
pub fn into_box(self) -> Result<SchemaRefMut<'pointer>, Self>
Borrow the schema ref as a SchemaBox if it is one.
Sourcepub fn into_access_mut(self) -> SchemaRefMutAccess<'pointer>
pub fn into_access_mut(self) -> SchemaRefMutAccess<'pointer>
Convert into an accessor for the inner data.
Sourcepub fn access_mut(&mut self) -> SchemaRefMutAccess<'_>
pub fn access_mut(&mut self) -> SchemaRefMutAccess<'_>
Get a mutable access helper to this reference.
Sourcepub fn as_ref(&self) -> SchemaRef<'_>
pub fn as_ref(&self) -> SchemaRef<'_>
Borrow this SchemaRefMut as a SchemaRef.
Sourcepub fn reborrow(&mut self) -> SchemaRefMut<'_>
pub fn reborrow(&mut self) -> SchemaRefMut<'_>
Convert a borrowed SchemaRefMut to an owned SchemaRefMut with a lifetime matching
That of the borrow.
Sourcepub fn field<'a, I: Into<FieldIdx<'a>>>(
&mut self,
field_idx: I,
) -> Option<SchemaRefMut<'_>>
pub fn field<'a, I: Into<FieldIdx<'a>>>( &mut self, field_idx: I, ) -> Option<SchemaRefMut<'_>>
Get the reference to a field.
Sourcepub fn field_path<'a, I: IntoIterator<Item = FieldIdx<'a>>>(
&mut self,
path: I,
) -> Option<SchemaRefMut<'_>>
pub fn field_path<'a, I: IntoIterator<Item = FieldIdx<'a>>>( &mut self, path: I, ) -> Option<SchemaRefMut<'_>>
Get the field pointed to by the given path.
Sourcepub fn into_field_path<'a, I: IntoIterator<Item = FieldIdx<'a>>>(
self,
path: I,
) -> Option<Self>
pub fn into_field_path<'a, I: IntoIterator<Item = FieldIdx<'a>>>( self, path: I, ) -> Option<Self>
Get the field pointed to by the given path.
Sourcepub fn into_field<'a, I: Into<FieldIdx<'a>>>(
self,
field_idx: I,
) -> Result<SchemaRefMut<'pointer>, Self>
pub fn into_field<'a, I: Into<FieldIdx<'a>>>( self, field_idx: I, ) -> Result<SchemaRefMut<'pointer>, Self>
Get the reference to a field.