Trait naia_server::WorldRefType
source · [−]pub trait WorldRefType<P, E> where
P: ProtocolType, {
fn has_entity(&self, entity: &E) -> bool;
fn entities(&self) -> Vec<E, Global>ⓘ;
fn has_component<R>(&self, entity: &E) -> bool
where
R: ReplicateSafe<P>;
fn has_component_of_kind(
&self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> bool;
fn get_component<R>(
&'a self,
entity: &E
) -> Option<ReplicaRefWrapper<'a, P, R>>
where
R: ReplicateSafe<P>;
fn get_component_of_kind(
&self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> Option<ReplicaDynRefWrapper<'_, 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
get a list of all entities in the World
fn has_component<R>(&self, entity: &E) -> bool where
R: ReplicateSafe<P>,
fn has_component<R>(&self, entity: &E) -> bool where
R: ReplicateSafe<P>,
check whether entity contains component
fn has_component_of_kind(
&self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> bool
fn has_component_of_kind(
&self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> bool
check whether entity contains component, dynamically
fn get_component<R>(&'a self, entity: &E) -> Option<ReplicaRefWrapper<'a, P, R>> where
R: ReplicateSafe<P>,
fn get_component<R>(&'a self, entity: &E) -> Option<ReplicaRefWrapper<'a, P, R>> where
R: ReplicateSafe<P>,
gets an entity’s component
fn get_component_of_kind(
&self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> Option<ReplicaDynRefWrapper<'_, P>>
fn get_component_of_kind(
&self,
entity: &E,
component_kind: &<P as ProtocolType>::Kind
) -> Option<ReplicaDynRefWrapper<'_, P>>
gets an entity’s component, dynamically