Trait naia_shared::ReplicateSafe
source · [−]pub trait ReplicateSafe<P: Protocolize>: ReplicateInner {
Show 13 methods
fn kind(&self) -> P::Kind;
fn diff_mask_size(&self) -> u8;
fn dyn_ref(&self) -> ReplicaDynRef<'_, P>;
fn dyn_mut(&mut self) -> ReplicaDynMut<'_, P>;
fn into_protocol(self) -> P;
fn protocol_copy(&self) -> P;
fn mirror(&mut self, other: &P);
fn set_mutator(&mut self, mutator: &PropertyMutator);
fn write(
&self,
bit_writer: &mut dyn BitWrite,
converter: &dyn NetEntityHandleConverter
);
fn write_update(
&self,
diff_mask: &DiffMask,
bit_writer: &mut dyn BitWrite,
converter: &dyn NetEntityHandleConverter
);
fn read_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
update: ComponentUpdate<P::Kind>
);
fn has_entity_properties(&self) -> bool;
fn entities(&self) -> Vec<EntityHandle>;
}
Expand description
The part of Replicate which is object-safe
Required Methods
Gets the TypeId of the Message/Component, used to map to a registered Protocolize
fn diff_mask_size(&self) -> u8
fn diff_mask_size(&self) -> u8
Gets the number of bytes of the Message/Component’s DiffMask
fn dyn_ref(&self) -> ReplicaDynRef<'_, P>
fn dyn_ref(&self) -> ReplicaDynRef<'_, P>
Get an immutable reference to the inner Component/Message as a Replicate trait object
fn dyn_mut(&mut self) -> ReplicaDynMut<'_, P>
fn dyn_mut(&mut self) -> ReplicaDynMut<'_, P>
Get an mutable reference to the inner Component/Message as a Replicate trait object
fn into_protocol(self) -> P
fn into_protocol(self) -> P
Returns self as a Protocol
fn protocol_copy(&self) -> P
fn protocol_copy(&self) -> P
Returns a copy of self as a Protocol
Sets the current Replica to the state of another Replica of the same type
fn set_mutator(&mut self, mutator: &PropertyMutator)
fn set_mutator(&mut self, mutator: &PropertyMutator)
Set the Message/Component’s PropertyMutator, which keeps track of which Properties have been mutated, necessary to sync only the Properties that have changed with the client
fn write(
&self,
bit_writer: &mut dyn BitWrite,
converter: &dyn NetEntityHandleConverter
)
fn write(
&self,
bit_writer: &mut dyn BitWrite,
converter: &dyn NetEntityHandleConverter
)
Writes data into an outgoing byte stream, sufficient to completely recreate the Message/Component on the client
fn write_update(
&self,
diff_mask: &DiffMask,
bit_writer: &mut dyn BitWrite,
converter: &dyn NetEntityHandleConverter
)
fn write_update(
&self,
diff_mask: &DiffMask,
bit_writer: &mut dyn BitWrite,
converter: &dyn NetEntityHandleConverter
)
Write data into an outgoing byte stream, sufficient only to update the mutated Properties of the Message/Component on the client
fn read_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
update: ComponentUpdate<P::Kind>
)
fn read_apply_update(
&mut self,
converter: &dyn NetEntityHandleConverter,
update: ComponentUpdate<P::Kind>
)
Reads data from an incoming packet, sufficient to sync the in-memory Component with it’s replica on the Server
fn has_entity_properties(&self) -> bool
fn has_entity_properties(&self) -> bool
Returns whether has any EntityProperties
fn entities(&self) -> Vec<EntityHandle>
fn entities(&self) -> Vec<EntityHandle>
Returns a list of Entities contained within the Replica’s properties