Skip to main content

ComponentKinds

Struct ComponentKinds 

Source
pub struct ComponentKinds { /* private fields */ }
Expand description

A map to hold all component types

Implementations§

Source§

impl ComponentKinds

Source

pub fn new() -> Self

Creates an empty ComponentKinds registry.

Source

pub fn add_component<C: Replicate>(&mut self)

Registers replicated component type C, assigning it the next sequential net-ID.

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub fn kind_to_name(&self, component_kind: &ComponentKind) -> String

Returns the protocol name for component_kind. Panics if not registered.

Source

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.

Source

pub fn kind_is_immutable(&self, component_kind: &ComponentKind) -> bool

Returns true if the given kind was registered as an immutable component.

Source

pub fn all_names(&self) -> Vec<String>

Returns a sorted list of all registered component protocol names.

Trait Implementations§

Source§

impl Clone for ComponentKinds

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ComponentKinds

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V