Expand description
A voxelize world.
Fields
id: String
ID of the world, generated from nanoid!()
.
name: String
Name of the world, used for connection.
started: bool
Whether if the world has started.
Implementations
sourceimpl World
impl World
sourcepub fn new(name: &str, config: &WorldConfig) -> Self
pub fn new(name: &str, config: &WorldConfig) -> Self
Create a new voxelize world.
sourcepub fn read_resource<T: Resource>(&self) -> Fetch<'_, T>
pub fn read_resource<T: Resource>(&self) -> Fetch<'_, T>
Read an ECS resource generically.
sourcepub fn write_resource<T: Resource>(&mut self) -> FetchMut<'_, T>
pub fn write_resource<T: Resource>(&mut self) -> FetchMut<'_, T>
Write an ECS resource generically.
sourcepub fn read_component<T: Component>(&self) -> ReadStorage<'_, T>
pub fn read_component<T: Component>(&self) -> ReadStorage<'_, T>
Read an ECS component storage.
sourcepub fn write_component<T: Component>(&mut self) -> WriteStorage<'_, T>
pub fn write_component<T: Component>(&mut self) -> WriteStorage<'_, T>
Write an ECS component storage.
sourcepub fn get_entity(&self, ent_id: u32) -> Entity
pub fn get_entity(&self, ent_id: u32) -> Entity
Read an entity by ID in the ECS world.
sourcepub fn add_client(
&mut self,
id: &str,
username: &str,
addr: &Recipient<EncodedMessage>
)
pub fn add_client(
&mut self,
id: &str,
username: &str,
addr: &Recipient<EncodedMessage>
)
Add a client to the world by an ID and an Actix actor address.
sourcepub fn remove_client(&mut self, id: &str)
pub fn remove_client(&mut self, id: &str)
Remove a client from the world by endpoint.
pub fn set_dispatcher(&mut self, dispatch: ModifyDispatch)
sourcepub fn on_request(&mut self, client_id: &str, data: Message)
pub fn on_request(&mut self, client_id: &str, data: Message)
Handler for protobuf requests from clients.
sourcepub fn broadcast(&mut self, data: Message, filter: ClientFilter)
pub fn broadcast(&mut self, data: Message, filter: ClientFilter)
Broadcast a protobuf message to a subset or all of the clients in the world.
sourcepub fn send(&self, addr: &Recipient<EncodedMessage>, data: &Message)
pub fn send(&self, addr: &Recipient<EncodedMessage>, data: &Message)
Send a direct message to an endpoint
sourcepub fn config(&self) -> Fetch<'_, WorldConfig>
pub fn config(&self) -> Fetch<'_, WorldConfig>
Access to the world’s config.
sourcepub fn clients_mut(&mut self) -> FetchMut<'_, Clients>
pub fn clients_mut(&mut self) -> FetchMut<'_, Clients>
Access a mutable clients map in the ECS world.
sourcepub fn chunks_mut(&mut self) -> FetchMut<'_, Chunks>
pub fn chunks_mut(&mut self) -> FetchMut<'_, Chunks>
Access a mutable chunk manager in the ECS world.
sourcepub fn physics_mut(&mut self) -> FetchMut<'_, Physics>
pub fn physics_mut(&mut self) -> FetchMut<'_, Physics>
Access a mutable physics manager in the ECS world.
sourcepub fn terrain(&self) -> Fetch<'_, SeededTerrain>
pub fn terrain(&self) -> Fetch<'_, SeededTerrain>
Access the terrain of the ECS world.
sourcepub fn terrain_mut(&mut self) -> FetchMut<'_, SeededTerrain>
pub fn terrain_mut(&mut self) -> FetchMut<'_, SeededTerrain>
Access a mutable terrain of the ECS world.
sourcepub fn pipeline_mut(&mut self) -> FetchMut<'_, Pipeline>
pub fn pipeline_mut(&mut self) -> FetchMut<'_, Pipeline>
Access a mutable pipeline management in the ECS world.
sourcepub fn entities(&self) -> Read<'_, EntitiesRes>
pub fn entities(&self) -> Read<'_, EntitiesRes>
Access all entities in this ECS world.
sourcepub fn entities_mut(&mut self) -> FetchMut<'_, EntitiesRes>
pub fn entities_mut(&mut self) -> FetchMut<'_, EntitiesRes>
Access and mutate all entities in this ECS world.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for World
impl Send for World
impl Sync for World
impl Unpin for World
impl !UnwindSafe for World
Blanket Implementations
impl<T> Any for T where
T: Any,
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> TryDefault for T where
T: Default,
impl<T> TryDefault for T where
T: Default,
sourcefn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
sourcefn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls try_default
and panics on an error case.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more