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 cast_mut<T>(&mut self) -> &mut Twhere
T: HasSchema + 'static,
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.
Sourcepub fn try_cast_mut<T>(&mut self) -> Result<&mut T, SchemaMismatchError>where
T: HasSchema,
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.
Sourcepub fn cast_into_mut<T>(self) -> &'pointer mut Twhere
T: HasSchema,
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.
Sourcepub fn try_cast_into_mut<T>(
self,
) -> Result<&'pointer mut T, SchemaMismatchError>where
T: HasSchema,
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.
Sourcepub fn new<T>(v: &'pointer mut T) -> SchemaRefMut<'pointer>where
T: HasSchema,
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.
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, SchemaRefMut<'pointer>>
pub fn into_map(self) -> Result<&'pointer mut SchemaMap, SchemaRefMut<'pointer>>
Borrow the schema ref as a SchemaMap if it is one.
Sourcepub fn into_vec(self) -> Result<&'pointer mut SchemaVec, SchemaRefMut<'pointer>>
pub fn into_vec(self) -> Result<&'pointer mut SchemaVec, SchemaRefMut<'pointer>>
Borrow the schema ref as a SchemaVec if it is one.
Sourcepub fn into_box(self) -> Result<SchemaRefMut<'pointer>, SchemaRefMut<'pointer>>
pub fn into_box(self) -> Result<SchemaRefMut<'pointer>, SchemaRefMut<'pointer>>
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>(&mut self, field_idx: I) -> Option<SchemaRefMut<'_>>
pub fn field<'a, I>(&mut self, field_idx: I) -> Option<SchemaRefMut<'_>>
Get the reference to a field.
Sourcepub fn field_path<'a, I>(&mut self, path: I) -> Option<SchemaRefMut<'_>>where
I: IntoIterator<Item = FieldIdx<'a>>,
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.
Sourcepub fn into_field_path<'a, I>(self, path: I) -> Option<SchemaRefMut<'pointer>>where
I: IntoIterator<Item = FieldIdx<'a>>,
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.
Sourcepub fn into_field<'a, I>(
self,
field_idx: I,
) -> Result<SchemaRefMut<'pointer>, SchemaRefMut<'pointer>>
pub fn into_field<'a, I>( self, field_idx: I, ) -> Result<SchemaRefMut<'pointer>, SchemaRefMut<'pointer>>
Get the reference to a field.
Trait Implementations§
Source§impl<'pointer> Debug for SchemaRefMut<'pointer>
impl<'pointer> Debug for SchemaRefMut<'pointer>
Source§impl<'a, 'de> DeserializeSeed<'de> for SchemaRefMut<'a>
impl<'a, 'de> DeserializeSeed<'de> for SchemaRefMut<'a>
Source§fn deserialize<D>(
self,
deserializer: D,
) -> Result<<SchemaRefMut<'a> as DeserializeSeed<'de>>::Value, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
self,
deserializer: D,
) -> Result<<SchemaRefMut<'a> as DeserializeSeed<'de>>::Value, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize::deserialize method, except
with some initial piece of data (the seed) passed in.