Skip to main content

Executor

Struct Executor 

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

Deterministic single-threaded executor: one step is one frame. The root future and every spawned task are polled once per step, in a fixed order (root, then tasks in spawn order). No wakers, no clocks, no threads — the same input always produces the same frames.

Implementations§

Source§

impl Executor

Source

pub fn new( fps: f64, meta: Meta, seed: u64, root: impl Future<Output = ()> + 'static, ) -> Self

seed feeds the scene’s random generator (random).

Source

pub fn enter<R>(&self, f: impl FnOnce() -> R) -> R

Runs f with this executor’s runtime installed, so that now(), tune! and friends work outside of step.

Source

pub fn step(&mut self) -> bool

Computes the next frame. Returns true if the scene is finished (its root future completed during this or an earlier step).

Source

pub fn is_finished(&self) -> bool

Whether the scene’s root task has completed.

Source

pub fn frames_done(&self) -> u32

Number of frames computed so far; the last computed frame is frames_done() - 1.

Source

pub fn fps(&self) -> f64

Frames per second.

Source

pub fn meta(&self) -> Meta

Current markers, eases and tunables, including defaults recorded so far.

Source

pub fn take_meta_changed(&self) -> bool

True if scene code recorded new defaults into the meta since the last call.

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V