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§
Sourcetype EntryBundle: IsBundle
type EntryBundle: IsBundle
A bundle where each of this bundle’s types are wrapped in Entry.
Required Methods§
Sourcefn unordered_types() -> SmallVec<[TypeId; 4]>
fn unordered_types() -> SmallVec<[TypeId; 4]>
Produces a list of types of a bundle, ordered by their position in the tuple.
Sourcefn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>
fn empty_vecs() -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>
Produces an unordered list of empty AnyVecs to store
components, with the given capacity.
Sourcefn into_vecs(self) -> SmallVec<[AnyVec<dyn Send + Sync + 'static>; 4]>
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.
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§
Sourcefn ordered_types() -> Result<SmallVec<[TypeId; 4]>, BundleError>
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.
fn empty_any_bundle() -> Result<AnyBundle, BundleError>
Sourcefn try_into_any_bundle(self) -> Result<AnyBundle, BundleError>
fn try_into_any_bundle(self) -> Result<AnyBundle, BundleError>
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.