Struct bones_asset::SchemaVec

pub struct SchemaVec { /* private fields */ }
Expand description

A type-erased Vec-like collection that for items with the same [Schema].

Implementations§

§

impl 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,

Push an item to the vec.

Errors

Errors if the schema of T doesn’t match the vec.

pub fn push<T>(&mut self, item: T)where T: HasSchema,

Push an item to the vec.

Panics

Panics if the schema of T doesn’t match the vec.

pub fn try_push_box( &mut self, item: SchemaBox ) -> Result<(), SchemaMismatchError>

Push the item into the end of the vector.

pub fn push_box(&mut self, item: SchemaBox)

Push the item into the end of the vector.

pub fn pop_box(&mut self) -> Option<SchemaBox>

Pop the last item off of the end of the vector.

pub fn try_pop<T>(&mut self) -> Result<Option<T>, SchemaMismatchError>where T: HasSchema,

Pop an item off the vec.

Errors

Errors if the schema of T doesn’t match.

pub fn pop<T>(&mut self) -> Option<T>where T: HasSchema,

Pop an item off the vec.

Panics

Panics if the schema of T doesn’t match.

pub fn try_get<T>(&self, idx: usize) -> Result<Option<&T>, SchemaMismatchError>where T: HasSchema,

Get an item in the vec.

Errors

Errors if the schema doesn’t match.

pub fn get<T>(&self, idx: usize) -> Option<&T>where T: HasSchema,

Get an item in the vec.

Panics

Panics if the schema doesn’t match.

pub fn get_ref(&self, idx: usize) -> Option<SchemaRef<'_>>

Get the item with the given index.

pub fn try_get_mut<T>( &mut self, idx: usize ) -> Result<Option<&mut T>, SchemaMismatchError>where T: HasSchema,

Get an item in the vec.

Errors

Errors if the schema doesn’t match.

pub fn get_mut<T>(&mut self, idx: usize) -> Option<&mut T>where T: HasSchema,

Get an item in the vec.

Panics

Panics if the schema doesn’t match.

pub fn get_ref_mut(&mut self, idx: usize) -> Option<SchemaRefMut<'_>>

Get an item with the given index.

pub fn len(&self) -> usize

Get the number of items in the vector.

pub fn is_empty(&self) -> bool

Returns true if the vector has zero items in it.

pub fn capacity(&self) -> usize

Get the capacity of the backing buffer.

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

Get the schema of items in this SchemaVec.

pub fn iter(&self) -> SchemaVecIter<'_>

Iterate over values in the vec

pub fn iter_mut(&mut self) -> SchemaVecIterMut<'_>

Iterate mutably over values in the vec

pub fn into_svec<T>(self) -> SVec<T>where T: HasSchema,

Convert into a typed SVec.

Panics

Panics if the schema of T doesn’t match this SchemaVec’s schema.

pub fn try_into_svec<T>(self) -> Result<SVec<T>, SchemaMismatchError>where T: HasSchema,

Try to convert into a typed SVec.

Errors

Errors if the schema of T doesn’t match this SchemaVec’s schema.

pub fn hash(&self) -> u64

Get the hash of this SchemaVec.

Panics

Panics if the inner type doesn’t implement hash.

pub unsafe fn raw_hash(ptr: *const c_void) -> u64

Raw version of the hash() function. Not meant for normal use.

Safety

Pointer must be a valid pointer to a SchemaVec.

pub unsafe fn raw_eq(a: *const c_void, b: *const c_void) -> bool

Raw version of the eq() function. Not meant for normal use.

Safety

Pointers must be valid pointers to SchemaVecs.

Trait Implementations§

§

impl Clone for SchemaVec

§

fn clone(&self) -> SchemaVec

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for SchemaVec

§

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

Formats the value using the given formatter. Read more
§

impl Drop for SchemaVec

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<'a> IntoIterator for &'a SchemaVec

§

type Item = SchemaRef<'a>

The type of the elements being iterated over.
§

type IntoIter = SchemaVecIter<'a>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <&'a SchemaVec as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl<'a> IntoIterator for &'a mut SchemaVec

§

type Item = SchemaRefMut<'a>

The type of the elements being iterated over.
§

type IntoIter = SchemaVecIterMut<'a>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> <&'a mut SchemaVec as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
§

impl PartialEq for SchemaVec

§

fn eq(&self, other: &SchemaVec) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Eq for SchemaVec

§

impl Send for SchemaVec

§

impl Sync for SchemaVec

Auto Trait Implementations§

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
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> RawClone for Twhere T: Clone,

§

unsafe fn raw_clone(src: *const c_void, dst: *mut c_void)

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

fn raw_clone_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void, *mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

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

impl<T> RawEq for Twhere T: Eq,

§

unsafe fn raw_eq(a: *const c_void, b: *const c_void) -> bool

Get the hash of the type. Read more
§

fn raw_eq_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void, *const c_void) -> bool + Send + Sync)>

Get a callback suitable for [SchemaData].
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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