Expand description
Threaded worlds, which run on their own thread. Worlds the host reaches through a proxy component: one on its own thread, or one the host steps itself.
Both leave the same proxy component on the host entity, so the hostβs world carries the same data either way. What differs is who drives the world: a thread of its own, or the hostβs own frames.
Whoever drives a world publishes its subscriptions: a turn of the loop drains the queue, runs the tick, and then publishes what the worldβs collectors returned. A tick body therefore collects nothing by hand and cannot publish twice.
Re-exportsΒ§
use async_channel::Receiver;πuse async_channel::bounded;πuse unlit_ecs::Bundle;πuse unlit_ecs::DynamicBundle;πuse unlit_ecs::Entity;πuse unlit_ecs::EntityAccessError;πuse unlit_ecs::World;πuse unlit_ecs::bundle;πuse crate::channel::publish_collected;πuse crate::executor::LocalTasks;πuse crate::handle::WorldHandle;πuse crate::job::Job;πuse crate::job::JobSender;πuse crate::job::SendError;πuse crate::thread::ThreadControl;πuse crate::thread::ThreadStatus;πuse crate::thread::WorldThread;πuse crate::thread::panic_message;πuse crate::thread::stepped_control;π
StructsΒ§
- Stepped
- A world the host steps, with no thread of its own.
- Stepped
World π - A world the host steps: the world, its command queue and its tick.
- Threaded
- A world on its own thread.
- World
Entity π - The entity a spawned world lives on: what drives it, the name it answers to, and the queue its jobs are posted through.
- World
Name - The name a spawned world answers to.
- World
Proxy π - The proxy component a spawned world leaves on the host.
- World
Sender - The host-side view of a spawned worldβs command queue.
EnumsΒ§
- Step
Error - Why a stepped world could not be driven through the entity that names it.
- Step
Outcome - What one turn of a stepped world did.
- World
Kind π - What drives a spawned world.
TraitsΒ§
- World
Runner - How a world is driven: on its own thread, or by the hostβs frames.
FunctionsΒ§
- drain_
all_ stepped_ worlds - Drain the queued jobs of every world the host steps.
- run_
queued_ πjobs - Run the jobs a stepped world has queued, stopping at the first panic.
- spawn_
stepped_ world_ with_ init - Spawn a world the host steps, with a one-time setup step.
- spawn_
threaded_ world - Spawn a threaded world on a fresh thread, driven by
tick. - spawn_
threaded_ world_ with_ init - Like
spawn_threaded_world, with a one-time setup step. - step_
stepped_ world - Drain a stepped worldβs jobs and run its tick once with
delta_seconds. - with_
stepped_ world - Run
fagainst a stepped worldβs world. - with_
stepped_ world_ mut - Run
fagainst a stepped worldβs world mutably.
Type AliasesΒ§
- Tick π
- The tick a world runs, with its one-time state already captured.