Struct bones_lib::prelude::bones_schema::alloc::SchemaVec
pub struct SchemaVec { /* private fields */ }
Expand description
A type-erased Vec
-like collection that for items with the same [Schema
].
Implementations§
§impl SchemaVec
impl SchemaVec
pub fn new(schema: &'static Schema) -> SchemaVec
pub fn new(schema: &'static Schema) -> SchemaVec
Initialize an empty SchemaVec
for items with the given schema.
pub fn try_push<T>(&mut self, item: T) -> Result<(), SchemaMismatchError>where
T: HasSchema,
pub fn try_push<T>(&mut self, item: T) -> Result<(), SchemaMismatchError>where
T: HasSchema,
pub fn try_push_box(
&mut self,
item: SchemaBox,
) -> Result<(), SchemaMismatchError>
pub fn try_push_box( &mut self, item: SchemaBox, ) -> Result<(), SchemaMismatchError>
Push the item into the end of the vector.
pub fn try_pop<T>(&mut self) -> Result<Option<T>, SchemaMismatchError>where
T: HasSchema,
pub fn try_pop<T>(&mut self) -> Result<Option<T>, SchemaMismatchError>where
T: HasSchema,
pub fn try_get_mut<T>(
&mut self,
idx: usize,
) -> Result<Option<&mut T>, SchemaMismatchError>where
T: HasSchema,
pub fn try_get_mut<T>(
&mut self,
idx: usize,
) -> Result<Option<&mut T>, SchemaMismatchError>where
T: HasSchema,
pub fn get_ref_mut(&mut self, idx: usize) -> Option<SchemaRefMut<'_>>
pub fn get_ref_mut(&mut self, idx: usize) -> Option<SchemaRefMut<'_>>
Get an item with the given index.
pub fn iter(&self) -> SchemaVecIter<'_> ⓘ
pub fn iter(&self) -> SchemaVecIter<'_> ⓘ
Iterate over values in the vec
pub fn iter_mut(&mut self) -> SchemaVecIterMut<'_> ⓘ
pub fn iter_mut(&mut self) -> SchemaVecIterMut<'_> ⓘ
Iterate mutably over values in the vec
pub fn try_into_svec<T>(self) -> Result<SVec<T>, SchemaMismatchError>where
T: HasSchema,
pub fn try_into_svec<T>(self) -> Result<SVec<T>, SchemaMismatchError>where
T: HasSchema,
pub fn remove(&mut self, index: usize) -> SchemaBox
pub fn remove(&mut self, index: usize) -> SchemaBox
Remove and return the element at position index
within the vector,
shifting all elements after it to the left.
§Panics
Panics if index
is out of bounds.
pub fn clear(&mut self)
pub fn clear(&mut self)
Clears the vector, removing all values.
Trait Implementations§
§impl<'a> IntoIterator for &'a SchemaVec
impl<'a> IntoIterator for &'a SchemaVec
§impl<'a> IntoIterator for &'a mut SchemaVec
impl<'a> IntoIterator for &'a mut SchemaVec
§type Item = SchemaRefMut<'a>
type Item = SchemaRefMut<'a>
The type of the elements being iterated over.
§type IntoIter = SchemaVecIterMut<'a>
type IntoIter = SchemaVecIterMut<'a>
Which kind of iterator are we turning this into?
impl Eq for SchemaVec
impl Send for SchemaVec
impl Sync for SchemaVec
Auto Trait Implementations§
impl Freeze for SchemaVec
impl !RefUnwindSafe for SchemaVec
impl Unpin for SchemaVec
impl !UnwindSafe for SchemaVec
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
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more