Skip to main content

EngineContext

Struct EngineContext 

Source
pub struct EngineContext<'a> {
    pub world: WorldAccess<'a>,
    pub runtime: Arc<Runtime>,
    pub bus: &'a LaneBus,
    pub deck: &'a mut OutputDeck,
}
Expand description

Engine context providing access to various subsystems.

Built once per frame by the Scheduler and passed to every Agent’s execute(). The Agent forwards bus and deck to its LaneContext so that lanes can read Flow outputs and write their own outputs.

The runtime bundle exposes the three runtime containers (Services, Backends, Resources) — agents pick the right one based on what they’re looking for.

Fields§

§world: WorldAccess<'a>

The ECS World access this agent was granted — see WorldAccess. Reach it through world_ref (read) or world_mut (mutate), never by matching directly.

§runtime: Arc<Runtime>

Runtime containers — services (business APIs), backends (trait impls), resources (shared state).

§bus: &'a LaneBus

Read-only typed bus of Flow outputs produced this tick. Lanes consume Views from here.

§deck: &'a mut OutputDeck

Mutable typed deck for lane outputs (recorded GPU commands, draw lists, etc.). Drained by the engine at the I/O boundary.

Implementations§

Source§

impl EngineContext<'_>

Source

pub fn world_ref(&self) -> Option<&dyn Any>

Read-only access to the type-erased World, if any was granted. Available under both Shared and Exclusive access (a mutable grant also permits reads). None for an Isolated (world-free) agent.

Source

pub fn world_mut(&mut self) -> Option<&mut dyn Any>

Mutable access to the type-erased World, granted only under Exclusive access. None for Shared or Isolated agents — a read-only or world-free agent must never mutate the world.

Auto Trait Implementations§

§

impl<'a> Freeze for EngineContext<'a>

§

impl<'a> !RefUnwindSafe for EngineContext<'a>

§

impl<'a> !Send for EngineContext<'a>

§

impl<'a> !Sync for EngineContext<'a>

§

impl<'a> Unpin for EngineContext<'a>

§

impl<'a> UnsafeUnpin for EngineContext<'a>

§

impl<'a> !UnwindSafe for EngineContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AppLifecycle for T
where T: ?Sized,

Source§

fn on_start(&mut self, ctx: &mut dyn AppContext)

Called once after the backend is up but before the first update. Apps install their theme / fonts here.
Source§

fn on_exit(&mut self)

Called once when the window is closing. Persist state here.
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Returns a reference to the inner value as &dyn Any.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.