pub trait WorldRefType<E> {
// Required methods
fn has_entity(&self, entity: &E) -> bool;
fn entities(&self) -> Vec<E>;
fn has_component<R: ReplicatedComponent>(&self, entity: &E) -> bool;
fn has_component_of_kind(
&self,
entity: &E,
component_kind: &ComponentKind,
) -> bool;
fn component<'a, R: ReplicatedComponent>(
&'a self,
entity: &E,
) -> Option<ReplicaRefWrapper<'a, R>>;
fn component_of_kind<'a>(
&'a self,
entity: &E,
component_kind: &ComponentKind,
) -> Option<ReplicaDynRefWrapper<'a>>;
}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§
Sourcefn has_entity(&self, entity: &E) -> bool
fn has_entity(&self, entity: &E) -> bool
check whether entity exists
Sourcefn has_component<R: ReplicatedComponent>(&self, entity: &E) -> bool
fn has_component<R: ReplicatedComponent>(&self, entity: &E) -> bool
check whether entity contains component
Sourcefn has_component_of_kind(
&self,
entity: &E,
component_kind: &ComponentKind,
) -> bool
fn has_component_of_kind( &self, entity: &E, component_kind: &ComponentKind, ) -> bool
check whether entity contains component, dynamically
Sourcefn component<'a, R: ReplicatedComponent>(
&'a self,
entity: &E,
) -> Option<ReplicaRefWrapper<'a, R>>
fn component<'a, R: ReplicatedComponent>( &'a self, entity: &E, ) -> Option<ReplicaRefWrapper<'a, R>>
gets an entity’s component
Sourcefn component_of_kind<'a>(
&'a self,
entity: &E,
component_kind: &ComponentKind,
) -> Option<ReplicaDynRefWrapper<'a>>
fn component_of_kind<'a>( &'a self, entity: &E, component_kind: &ComponentKind, ) -> Option<ReplicaDynRefWrapper<'a>>
gets an entity’s component, dynamically
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.