Skip to main content

Module bundle

Module bundle 

Source
Expand description

Bundles: the set of components an entity is spawned with.

A bundle is either a DynamicBundle, which the crate::bundle! macro writes, or a type of the caller’s own that implements Bundle over its components. It is not a tuple: every 'static type is a component, tuples included, so a bare (a, b) handed to spawn names one component rather than two. Writing bundle![a, b] is what names two.

The macro takes its items one at a time and each item is one component, so a parenthesised item is a tuple component rather than a list to unpack: a bundle only spreads when it is written as ..value.

The same component cannot appear twice in a bundle; spawning with duplicates panics.

Re-exports§

use core::any::Any; 🔒
use core::any::TypeId; 🔒
use crate::column::AnyColumn; 🔒
use crate::column::Column; 🔒

Structs§

BundleComponent 🔒
One component of a bundle: its type, the name and column constructor the world registers it under, and the value box the archetype takes.
DynamicBundle
A bundle assembled at runtime.

Traits§

Bundle
A set of components to spawn an entity with.

Functions§

sort_components 🔒
Put a bundle’s components in type order, which is the order an archetype stores its columns in.

Type Aliases§

Components 🔒
The components of one bundle, sorted by type.