Skip to main content

OutputDeck

Struct OutputDeck 

Source
pub struct OutputDeck { /* private fields */ }
Expand description

Mutable typed deck collecting lane outputs for one tick.

Each typed slot is created on first access, holding T::default() until a lane writes into it. The engine drains specific types at the I/O boundary (submit, present) via OutputDeck::take.

Implementations§

Source§

impl OutputDeck

Source

pub fn new() -> Self

Creates an empty deck.

Source

pub fn slot<T: Default + Any + Send + Sync>(&mut self) -> &mut T

Returns a mutable reference to the slot for type T, creating it with T::default() on first access.

Lanes call this to accumulate outputs (e.g. push command buffers onto a Vec).

Source

pub fn take<T: Default + Any + Send + Sync>(&mut self) -> T

Removes and returns the slot for type T, replacing it with the default value (so subsequent ticks start clean).

Returns T::default() if no lane wrote into this slot during the tick. Used by the engine at the I/O boundary.

Source

pub fn contains<T: Any + Send + Sync>(&self) -> bool

Reports whether a slot of the given type has been written this tick.

Source

pub fn len(&self) -> usize

Number of slots currently holding data.

Source

pub fn is_empty(&self) -> bool

Whether no slots have been written.

Source

pub fn clear(&mut self)

Clears all slots. Called by the scheduler between ticks if a deck instance is reused rather than reallocated.

Source

pub fn merge_from(&mut self, other: OutputDeck)

Moves every slot from other into self.

Used by the parallel executor to fold a worker’s private deck shard back into the shared deck after a concurrent wave. The merged shards are expected to write disjoint slot types (guaranteed by the executor’s AgentAccess::Isolated eligibility rules). A colliding TypeId is therefore a scheduling bug: the existing slot is kept and the collision logged, rather than silently dropping one side’s outputs.

Trait Implementations§

Source§

impl Debug for OutputDeck

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OutputDeck

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.