pub struct StateBuilder<'t, S, L> { /* private fields */ }Available on
stageleft_runtime only.Expand description
Builder returned by state, which accepts the user-provided initializer.
Implementations§
Source§impl<'t, 'a, S, L: Location<'a>> StateBuilder<'t, S, L>
impl<'t, 'a, S, L: Location<'a>> StateBuilder<'t, S, L>
Sourcepub fn build(
self,
initial_fn: impl FnOnce(&'t Tick<L>) -> S,
) -> (TickCycleHandle<'a, S>, S)
pub fn build( self, initial_fn: impl FnOnce(&'t Tick<L>) -> S, ) -> (TickCycleHandle<'a, S>, S)
Supplies the initializer closure and creates the stateful cycle.
The initializer takes the tick at the builder’s 't lifetime (rather than a
higher-ranked for<'x> bound), since the builder already stores the tick reference.
This way, an initializer that requires a specific tick reference lifetime produces a
borrow error directly on the tick, instead of a confusing “implementation of Fn is
not general enough” error that blames an unrelated variable.
Auto Trait Implementations§
impl<'t, S, L> Freeze for StateBuilder<'t, S, L>
impl<'t, S, L> RefUnwindSafe for StateBuilder<'t, S, L>where
L: RefUnwindSafe,
impl<'t, S, L> Send for StateBuilder<'t, S, L>where
L: Sync,
impl<'t, S, L> Sync for StateBuilder<'t, S, L>where
L: Sync,
impl<'t, S, L> Unpin for StateBuilder<'t, S, L>
impl<'t, S, L> UnsafeUnpin for StateBuilder<'t, S, L>
impl<'t, S, L> UnwindSafe for StateBuilder<'t, S, L>where
L: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.