IsBundle

Trait IsBundle 

Source
pub trait IsBundle: Sized {
    type EntryBundle: IsBundle;
    type MutBundle: IsBundle;

    // Required methods
    fn unordered_types() -> SmallVec<[TypeId; 4]>;
    fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>;
    fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>;
    fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>;
    fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle;
    fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self;

    // Provided methods
    fn ordered_types() -> Result<SmallVec<[TypeId; 4]>, BundleError> { ... }
    fn empty_any_bundle() -> Result<AnyBundle, BundleError> { ... }
    fn try_into_any_bundle(self) -> Result<AnyBundle, BundleError> { ... }
}
Expand description

Provides runtime type info about bundles and more.

Required Associated Types§

Source

type EntryBundle: IsBundle

A bundle where each of this bundle’s types are wrapped in Entry.

Source

type MutBundle: IsBundle

A bundle where each of this bundle’s types are prefixed with &’static mut.

Required Methods§

Source

fn unordered_types() -> SmallVec<[TypeId; 4]>

Produces a list of types of a bundle, ordered by their position in the tuple.

Source

fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Produces an unordered list of empty AnyVecs to store components, with the given capacity.

Source

fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Produces a list of AnyVecs of length 1, each containing its corresponding component. The list is ordered by each component’s position in the tuple.

Source

fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>

Source

fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle

Source

fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self

Provided Methods§

Source

fn ordered_types() -> Result<SmallVec<[TypeId; 4]>, BundleError>

Produces a list of types in a bundle, ordered ascending.

Errors if the bundle contains duplicate types.

Source

fn empty_any_bundle() -> Result<AnyBundle, BundleError>

Source

fn try_into_any_bundle(self) -> Result<AnyBundle, BundleError>

Converts the tuple into a type-erased AnyBundle.

§Errs

Errs if the tuple contains duplicate types.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<A, B> IsBundle for (A, B)
where A: Send + Sync + 'static, B: Send + Sync + 'static,

Source§

type EntryBundle = (Entry<A>, Entry<B>)

Source§

type MutBundle = (&'static mut A, &'static mut B)

Source§

fn unordered_types() -> SmallVec<[TypeId; 4]>

Source§

fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>

Source§

fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle

Source§

fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self

Source§

impl<A, B, C> IsBundle for (A, B, C)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static,

Source§

type EntryBundle = (Entry<A>, Entry<B>, Entry<C>)

Source§

type MutBundle = (&'static mut A, &'static mut B, &'static mut C)

Source§

fn unordered_types() -> SmallVec<[TypeId; 4]>

Source§

fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>

Source§

fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle

Source§

fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self

Source§

impl<A, B, C, D> IsBundle for (A, B, C, D)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static,

Source§

type EntryBundle = (Entry<A>, Entry<B>, Entry<C>, Entry<D>)

Source§

type MutBundle = (&'static mut A, &'static mut B, &'static mut C, &'static mut D)

Source§

fn unordered_types() -> SmallVec<[TypeId; 4]>

Source§

fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>

Source§

fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle

Source§

fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self

Source§

impl<A, B, C, D, E> IsBundle for (A, B, C, D, E)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static,

Source§

type EntryBundle = (Entry<A>, Entry<B>, Entry<C>, Entry<D>, Entry<E>)

Source§

type MutBundle = (&'static mut A, &'static mut B, &'static mut C, &'static mut D, &'static mut E)

Source§

fn unordered_types() -> SmallVec<[TypeId; 4]>

Source§

fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>

Source§

fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle

Source§

fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self

Source§

impl<A, B, C, D, E, F> IsBundle for (A, B, C, D, E, F)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static, F: Send + Sync + 'static,

Source§

type EntryBundle = (Entry<A>, Entry<B>, Entry<C>, Entry<D>, Entry<E>, Entry<F>)

Source§

type MutBundle = (&'static mut A, &'static mut B, &'static mut C, &'static mut D, &'static mut E, &'static mut F)

Source§

fn unordered_types() -> SmallVec<[TypeId; 4]>

Source§

fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>

Source§

fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle

Source§

fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self

Source§

impl<A, B, C, D, E, F, G> IsBundle for (A, B, C, D, E, F, G)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static, F: Send + Sync + 'static, G: Send + Sync + 'static,

Source§

impl<A, B, C, D, E, F, G, H> IsBundle for (A, B, C, D, E, F, G, H)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static, F: Send + Sync + 'static, G: Send + Sync + 'static, H: Send + Sync + 'static,

Source§

impl<A, B, C, D, E, F, G, H, I> IsBundle for (A, B, C, D, E, F, G, H, I)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static, F: Send + Sync + 'static, G: Send + Sync + 'static, H: Send + Sync + 'static, I: Send + Sync + 'static,

Source§

impl<A, B, C, D, E, F, G, H, I, J> IsBundle for (A, B, C, D, E, F, G, H, I, J)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static, F: Send + Sync + 'static, G: Send + Sync + 'static, H: Send + Sync + 'static, I: Send + Sync + 'static, J: Send + Sync + 'static,

Source§

impl<A, B, C, D, E, F, G, H, I, J, K> IsBundle for (A, B, C, D, E, F, G, H, I, J, K)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static, F: Send + Sync + 'static, G: Send + Sync + 'static, H: Send + Sync + 'static, I: Send + Sync + 'static, J: Send + Sync + 'static, K: Send + Sync + 'static,

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> IsBundle for (A, B, C, D, E, F, G, H, I, J, K, L)
where A: Send + Sync + 'static, B: Send + Sync + 'static, C: Send + Sync + 'static, D: Send + Sync + 'static, E: Send + Sync + 'static, F: Send + Sync + 'static, G: Send + Sync + 'static, H: Send + Sync + 'static, I: Send + Sync + 'static, J: Send + Sync + 'static, K: Send + Sync + 'static, L: Send + Sync + 'static,

Source§

impl<A: Send + Sync + 'static> IsBundle for (A,)

Source§

type EntryBundle = (Entry<A>,)

Source§

type MutBundle = (&'static mut A,)

Source§

fn unordered_types() -> SmallVec<[TypeId; 4]>

Source§

fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>

Source§

fn try_from_any_bundle(bundle: AnyBundle) -> Result<Self, BundleError>

Source§

fn into_entry_bundle(self, entity_id: usize) -> Self::EntryBundle

Source§

fn from_entry_bundle(entry_bundle: Self::EntryBundle) -> Self

Implementors§