Struct bones_schema::alloc::SMap
source · pub struct SMap<K: HasSchema, V: HasSchema> { /* private fields */ }
Expand description
Implementations§
source§impl<K: HasSchema, V: HasSchema> SMap<K, V>
impl<K: HasSchema, V: HasSchema> SMap<K, V>
sourcepub fn insert(&mut self, k: K, v: V) -> Option<V>
pub fn insert(&mut self, k: K, v: V) -> Option<V>
Insert an entry into the map, returning the previous value, if it exists.
sourcepub fn get_mut(&mut self, key: &K) -> Option<&mut V>
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
Get a mutable reference to an item in the map.
sourcepub fn into_schema_map(self) -> SchemaMap
pub fn into_schema_map(self) -> SchemaMap
Convert into an untyped SchemaMap
.
sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Returns true if the map contains a value for the specified key.
source§impl<K: HasSchema, V: HasSchema> SMap<K, V>
impl<K: HasSchema, V: HasSchema> SMap<K, V>
sourcepub fn iter(
&self,
) -> Map<Iter<'_, SchemaBox, SchemaBox>, for<'a> fn(_: (&'a SchemaBox, &'a SchemaBox)) -> (&'a K, &'a V)> ⓘ
pub fn iter( &self, ) -> Map<Iter<'_, SchemaBox, SchemaBox>, for<'a> fn(_: (&'a SchemaBox, &'a SchemaBox)) -> (&'a K, &'a V)> ⓘ
Iterate over entries in the map.
sourcepub fn iter_mut(
&mut self,
) -> Map<IterMut<'_, SchemaBox, SchemaBox>, for<'a> fn(_: (&'a SchemaBox, &'a mut SchemaBox)) -> (&'a K, &'a mut V)> ⓘ
pub fn iter_mut( &mut self, ) -> Map<IterMut<'_, SchemaBox, SchemaBox>, for<'a> fn(_: (&'a SchemaBox, &'a mut SchemaBox)) -> (&'a K, &'a mut V)> ⓘ
Iterate over entries in the map.
sourcepub fn keys(
&self,
) -> Map<Keys<'_, SchemaBox, SchemaBox>, for<'a> fn(_: &'a SchemaBox) -> &'a K> ⓘ
pub fn keys( &self, ) -> Map<Keys<'_, SchemaBox, SchemaBox>, for<'a> fn(_: &'a SchemaBox) -> &'a K> ⓘ
Iterate over keys in the map.
Trait Implementations§
source§impl<K: HasSchema, V: HasSchema> HasSchema for SMap<K, V>
impl<K: HasSchema, V: HasSchema> HasSchema for SMap<K, V>
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<'a, K: HasSchema, V: HasSchema> IntoIterator for &'a SMap<K, V>
impl<'a, K: HasSchema, V: HasSchema> IntoIterator for &'a SMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for SMap<K, V>
impl<K, V> !RefUnwindSafe for SMap<K, V>
impl<K, V> Send for SMap<K, V>
impl<K, V> Sync for SMap<K, V>
impl<K, V> Unpin for SMap<K, V>
impl<K, V> !UnwindSafe for SMap<K, V>
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
)