Trait naia_shared::Replicate
source · pub trait Replicate:
Sync
+ Send
+ 'static
+ Named
+ Any {
Show 22 methods
// Required methods
fn kind(&self) -> ComponentKind;
fn to_any(&self) -> &dyn Any;
fn to_any_mut(&mut self) -> &mut dyn Any;
fn to_boxed_any(self: Box<Self>) -> Box<dyn Any>;
fn copy_to_box(&self) -> Box<dyn Replicate>;
fn create_builder() -> Box<dyn ReplicateBuilder>
where Self: Sized;
fn diff_mask_size(&self) -> u8;
fn dyn_ref(&self) -> ReplicaDynRef<'_>;
fn dyn_mut(&mut self) -> ReplicaDynMut<'_>;
fn mirror(&mut self, other: &dyn Replicate);
fn set_mutator(&mut self, mutator: &PropertyMutator);
fn write(
&self,
component_kinds: &ComponentKinds,
writer: &mut dyn BitWrite,
converter: &mut dyn LocalEntityAndGlobalEntityConverterMut,
);
fn write_update(
&self,
diff_mask: &DiffMask,
writer: &mut dyn BitWrite,
converter: &mut dyn LocalEntityAndGlobalEntityConverterMut,
);
fn read_apply_update(
&mut self,
converter: &dyn LocalEntityAndGlobalEntityConverter,
update: ComponentUpdate,
) -> Result<(), SerdeErr>;
fn read_apply_field_update(
&mut self,
converter: &dyn LocalEntityAndGlobalEntityConverter,
update: ComponentFieldUpdate,
) -> Result<(), SerdeErr>;
fn relations_waiting(&self) -> Option<HashSet<RemoteEntity>>;
fn relations_complete(
&mut self,
converter: &dyn LocalEntityAndGlobalEntityConverter,
);
fn publish(&mut self, mutator: &PropertyMutator);
fn unpublish(&mut self);
fn enable_delegation(
&mut self,
accessor: &EntityAuthAccessor,
mutator_opt: Option<&PropertyMutator>,
);
fn disable_delegation(&mut self);
fn localize(&mut self);
}
Expand description
A struct that implements Replicate is a Component, or otherwise, a container of Properties that can be scoped, tracked, and synced, with a remote host
Required Methods§
sourcefn kind(&self) -> ComponentKind
fn kind(&self) -> ComponentKind
Gets the ComponentKind of this type
fn to_any(&self) -> &dyn Any
fn to_any_mut(&mut self) -> &mut dyn Any
fn to_boxed_any(self: Box<Self>) -> Box<dyn Any>
fn copy_to_box(&self) -> Box<dyn Replicate>
fn create_builder() -> Box<dyn ReplicateBuilder>where
Self: Sized,
sourcefn diff_mask_size(&self) -> u8
fn diff_mask_size(&self) -> u8
Gets the number of bytes of the Component’s DiffMask
sourcefn dyn_ref(&self) -> ReplicaDynRef<'_>
fn dyn_ref(&self) -> ReplicaDynRef<'_>
Get an immutable reference to the inner Component as a Replicate trait object
sourcefn dyn_mut(&mut self) -> ReplicaDynMut<'_>
fn dyn_mut(&mut self) -> ReplicaDynMut<'_>
Get an mutable reference to the inner Component as a Replicate trait object
sourcefn mirror(&mut self, other: &dyn Replicate)
fn mirror(&mut self, other: &dyn Replicate)
Sets the current Component to the state of another Component of the same type
sourcefn set_mutator(&mut self, mutator: &PropertyMutator)
fn set_mutator(&mut self, mutator: &PropertyMutator)
Set the Component’s PropertyMutator, which keeps track of which Properties have been mutated, necessary to sync only the Properties that have changed with the client
sourcefn write(
&self,
component_kinds: &ComponentKinds,
writer: &mut dyn BitWrite,
converter: &mut dyn LocalEntityAndGlobalEntityConverterMut,
)
fn write( &self, component_kinds: &ComponentKinds, writer: &mut dyn BitWrite, converter: &mut dyn LocalEntityAndGlobalEntityConverterMut, )
Writes data into an outgoing byte stream, sufficient to completely recreate the Component on the client
sourcefn write_update(
&self,
diff_mask: &DiffMask,
writer: &mut dyn BitWrite,
converter: &mut dyn LocalEntityAndGlobalEntityConverterMut,
)
fn write_update( &self, diff_mask: &DiffMask, writer: &mut dyn BitWrite, converter: &mut dyn LocalEntityAndGlobalEntityConverterMut, )
Write data into an outgoing byte stream, sufficient only to update the mutated Properties of the Component on the client
sourcefn read_apply_update(
&mut self,
converter: &dyn LocalEntityAndGlobalEntityConverter,
update: ComponentUpdate,
) -> Result<(), SerdeErr>
fn read_apply_update( &mut self, converter: &dyn LocalEntityAndGlobalEntityConverter, update: ComponentUpdate, ) -> Result<(), SerdeErr>
Reads data from an incoming packet, sufficient to sync the in-memory Component with it’s replica on the Server
fn read_apply_field_update( &mut self, converter: &dyn LocalEntityAndGlobalEntityConverter, update: ComponentFieldUpdate, ) -> Result<(), SerdeErr>
sourcefn relations_waiting(&self) -> Option<HashSet<RemoteEntity>>
fn relations_waiting(&self) -> Option<HashSet<RemoteEntity>>
Returns a list of LocalEntities contained within the Component’s EntityProperty fields, which are waiting to be converted to GlobalEntities
sourcefn relations_complete(
&mut self,
converter: &dyn LocalEntityAndGlobalEntityConverter,
)
fn relations_complete( &mut self, converter: &dyn LocalEntityAndGlobalEntityConverter, )
Converts any LocalEntities contained within the Component’s EntityProperty fields to GlobalEntities
sourcefn publish(&mut self, mutator: &PropertyMutator)
fn publish(&mut self, mutator: &PropertyMutator)
Publish Replicate
sourcefn enable_delegation(
&mut self,
accessor: &EntityAuthAccessor,
mutator_opt: Option<&PropertyMutator>,
)
fn enable_delegation( &mut self, accessor: &EntityAuthAccessor, mutator_opt: Option<&PropertyMutator>, )
Enable Delegation Replicate
sourcefn disable_delegation(&mut self)
fn disable_delegation(&mut self)
Disable Delegation Replicate