pub struct ComponentKinds { /* private fields */ }Expand description
A map to hold all component types
Implementations§
Source§impl ComponentKinds
impl ComponentKinds
Sourcepub fn add_component<C: Replicate>(&mut self)
pub fn add_component<C: Replicate>(&mut self)
Registers replicated component type C, assigning it the next sequential net-ID.
Sourcepub fn kind_count(&self) -> u16
pub fn kind_count(&self) -> u16
Number of component kinds currently registered. Used at
UserDiffHandler construction to size the per-user DirtyQueue’s
stride (= ceil(kind_count / 64) AtomicU64 words per entity).
Sourcepub fn read(
&self,
reader: &mut BitReader<'_>,
converter: &dyn LocalEntityAndGlobalEntityConverter,
) -> Result<Box<dyn Replicate>, SerdeErr>
pub fn read( &self, reader: &mut BitReader<'_>, converter: &dyn LocalEntityAndGlobalEntityConverter, ) -> Result<Box<dyn Replicate>, SerdeErr>
Reads a component kind tag then deserializes and returns the component from reader.
Sourcepub fn read_create_update(
&self,
reader: &mut BitReader<'_>,
) -> Result<ComponentUpdate, SerdeErr>
pub fn read_create_update( &self, reader: &mut BitReader<'_>, ) -> Result<ComponentUpdate, SerdeErr>
Reads a component kind tag then deserializes an initial-create update payload from reader.
Sourcepub fn split_update(
&self,
converter: &dyn LocalEntityAndGlobalEntityConverter,
component_kind: &ComponentKind,
update: ComponentUpdate,
) -> Result<(Option<Vec<(RemoteEntity, ComponentFieldUpdate)>>, Option<ComponentUpdate>), SerdeErr>
pub fn split_update( &self, converter: &dyn LocalEntityAndGlobalEntityConverter, component_kind: &ComponentKind, update: ComponentUpdate, ) -> Result<(Option<Vec<(RemoteEntity, ComponentFieldUpdate)>>, Option<ComponentUpdate>), SerdeErr>
Splits a full-component update into a waiting portion and a ready-to-apply portion.
Sourcepub fn kind_to_name(&self, component_kind: &ComponentKind) -> String
pub fn kind_to_name(&self, component_kind: &ComponentKind) -> String
Returns the protocol name for component_kind. Panics if not registered.
Sourcepub fn net_id_of(&self, component_kind: &ComponentKind) -> Option<u16>
pub fn net_id_of(&self, component_kind: &ComponentKind) -> Option<u16>
Public accessor for a kind’s NetId (== bit position in the
DirtyQueue u64 mask, max 64). Returns None for unregistered
kinds.
Sourcepub fn kind_is_immutable(&self, component_kind: &ComponentKind) -> bool
pub fn kind_is_immutable(&self, component_kind: &ComponentKind) -> bool
Returns true if the given kind was registered as an immutable component.