pub trait ComponentSlot: Sized + 'static {
const DISCRIMINANT: u8;
// Required methods
fn slot(s: &ComponentStorage) -> &Column<Self>;
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>;
}Expand description
Resolves a component type to its column inside the storage at compile
time, so the generic storage operations above need no runtime
dispatch. A registered component is exactly a type with a $slot impl,
and DISCRIMINANT is its stable id, used as its ComponentId in the
join index. 'static: components own their data, and the generic ops
hand out borrows of (and owned vectors of) the type.
Required Associated Constants§
Sourceconst DISCRIMINANT: u8
const DISCRIMINANT: u8
The component type’s stable id, used as its ComponentId.
Required Methods§
Sourcefn slot(s: &ComponentStorage) -> &Column<Self>
fn slot(s: &ComponentStorage) -> &Column<Self>
Borrow this type’s column out of the storage.
Sourcefn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>
Mutably borrow this type’s column out of the storage.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".