[][src]Trait naia_server::Entity

pub trait Entity<T> where
    T: EntityType
{ fn get_state_mask_size(&self) -> u8;
fn get_typed_copy(&self) -> T;
fn get_type_id(&self) -> TypeId;
fn write(&self, out_bytes: &mut Vec<u8>);
fn write_partial(&self, state_mask: &StateMask, out_bytes: &mut Vec<u8>);
fn read_partial(&mut self, state_mask: &StateMask, in_bytes: &[u8]);
fn set_mutator(
        &mut self,
        mutator: &Rc<RefCell<dyn EntityMutator + 'static>>
    ); }

An Entity is a container of Properties that can be scoped, tracked, and synced, with a remote host

Required methods

fn get_state_mask_size(&self) -> u8

Gets the number of bytes of the Entity's State Mask

fn get_typed_copy(&self) -> T

Gets a copy of the Entity, wrapped in an EntityType enum (which is the common protocol between the server/host)

fn get_type_id(&self) -> TypeId

Gets the TypeId of the Entity's implementation, used to map to a registered EntityType

fn write(&self, out_bytes: &mut Vec<u8>)

Writes data into an outgoing byte stream, sufficient to completely recreate the Entity on the client

fn write_partial(&self, state_mask: &StateMask, out_bytes: &mut Vec<u8>)

Write data into an outgoing byte stream, sufficient only to update the mutated Properties of the Entity on the client

fn read_partial(&mut self, state_mask: &StateMask, in_bytes: &[u8])

Reads data from an incoming packet, sufficient to sync the in-memory Entity with it's state on the Server

fn set_mutator(&mut self, mutator: &Rc<RefCell<dyn EntityMutator + 'static>>)

Set the Entity's EntityMutator, which keeps track of which Properties have been mutated, necessary to sync only the Properties that have changed with the client

Loading content...

Trait Implementations

impl<T> Debug for dyn Entity<T> + 'static where
    T: EntityType
[src]

Implementors

Loading content...