Trait naia_shared::WorldRefType
source · [−]pub trait WorldRefType<P: Protocolize, E> {
fn has_entity(&self, entity: &E) -> bool;
fn entities(&self) -> Vec<E>;
fn has_component<R: ReplicateSafe<P>>(&self, entity: &E) -> bool;
fn has_component_of_kind(
&self,
entity: &E,
component_kind: &P::Kind
) -> bool;
fn component<'a, R: ReplicateSafe<P>>(
&'a self,
entity: &E
) -> Option<ReplicaRefWrapper<'a, P, R>>;
fn component_of_kind<'a>(
&'a self,
entity: &E,
component_kind: &P::Kind
) -> Option<ReplicaDynRefWrapper<'a, P>>;
}
Expand description
Structures that implement the WorldMutType trait will be able to be loaded into the Server at which point the Server will use this interface to keep the WorldMutType in-sync with it’s own Entities/Components
Required Methods
fn has_entity(&self, entity: &E) -> bool
fn has_entity(&self, entity: &E) -> bool
check whether entity exists
fn has_component<R: ReplicateSafe<P>>(&self, entity: &E) -> bool
fn has_component<R: ReplicateSafe<P>>(&self, entity: &E) -> bool
check whether entity contains component
fn has_component_of_kind(&self, entity: &E, component_kind: &P::Kind) -> bool
fn has_component_of_kind(&self, entity: &E, component_kind: &P::Kind) -> bool
check whether entity contains component, dynamically
fn component<'a, R: ReplicateSafe<P>>(
&'a self,
entity: &E
) -> Option<ReplicaRefWrapper<'a, P, R>>
fn component<'a, R: ReplicateSafe<P>>(
&'a self,
entity: &E
) -> Option<ReplicaRefWrapper<'a, P, R>>
gets an entity’s component
fn component_of_kind<'a>(
&'a self,
entity: &E,
component_kind: &P::Kind
) -> Option<ReplicaDynRefWrapper<'a, P>>
fn component_of_kind<'a>(
&'a self,
entity: &E,
component_kind: &P::Kind
) -> Option<ReplicaDynRefWrapper<'a, P>>
gets an entity’s component, dynamically