pub struct EffectRuntime<S, A, E, St = EffectStore<S, A, E>>where
A: Action,
St: EffectStoreLike<S, A, E>,{ /* private fields */ }Expand description
Runtime helper for effect-based stores.
Implementations§
Source§impl<S, A, E> EffectRuntime<S, A, E>where
S: 'static,
A: Action,
impl<S, A, E> EffectRuntime<S, A, E>where
S: 'static,
A: Action,
Sourcepub fn new(
state: S,
reducer: fn(&mut S, A) -> ReducerResult<E>,
) -> EffectRuntime<S, A, E>
pub fn new( state: S, reducer: fn(&mut S, A) -> ReducerResult<E>, ) -> EffectRuntime<S, A, E>
Create a runtime from state + effect reducer.
Source§impl<S, A, E, St> EffectRuntime<S, A, E, St>where
S: 'static,
A: Action,
St: EffectStoreLike<S, A, E>,
impl<S, A, E, St> EffectRuntime<S, A, E, St>where
S: 'static,
A: Action,
St: EffectStoreLike<S, A, E>,
Sourcepub fn from_store(store: St) -> EffectRuntime<S, A, E, St>
pub fn from_store(store: St) -> EffectRuntime<S, A, E, St>
Create a runtime from an existing effect store.
Sourcepub fn with_debug<D>(self, debug: D) -> EffectRuntime<S, A, E, St>where
D: DebugAdapter<S, A> + DebugHooks<A>,
pub fn with_debug<D>(self, debug: D) -> EffectRuntime<S, A, E, St>where
D: DebugAdapter<S, A> + DebugHooks<A>,
Attach a debug layer (auto-wires tasks/subscriptions when available).
Sourcepub fn with_event_poller(
self,
config: PollerConfig,
) -> EffectRuntime<S, A, E, St>
pub fn with_event_poller( self, config: PollerConfig, ) -> EffectRuntime<S, A, E, St>
Configure event polling behavior.
Sourcepub fn subscribe_actions(&self) -> Receiver<String>
pub fn subscribe_actions(&self) -> Receiver<String>
Subscribe to action name broadcasts.
Returns a receiver that will receive action names (from action.name())
whenever an action is dispatched. Useful for replay await functionality.
Sourcepub fn action_tx(&self) -> UnboundedSender<A>
pub fn action_tx(&self) -> UnboundedSender<A>
Clone the action sender.
Sourcepub async fn run<B, FRender, FEvent, FQuit, FEffect, R>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
map_event: FEvent,
should_quit: FQuit,
handle_effect: FEffect,
) -> Result<(), Error>
pub async fn run<B, FRender, FEvent, FQuit, FEffect, R>( &mut self, terminal: &mut Terminal<B>, render: FRender, map_event: FEvent, should_quit: FQuit, handle_effect: FEffect, ) -> Result<(), Error>
Run the event/action loop until quit.
Sourcepub async fn run_with_bus<B, FRender, FQuit, FEffect, Id, Ctx>(
&mut self,
terminal: &mut Terminal<B>,
bus: &mut EventBus<S, A, Id, Ctx>,
keybindings: &Keybindings<Ctx>,
render: FRender,
should_quit: FQuit,
handle_effect: FEffect,
) -> Result<(), Error>where
B: Backend,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
S: EventRoutingState<Id, Ctx>,
FRender: FnMut(&mut Frame<'_>, Rect, &S, RenderContext, &mut EventContext<Id>),
FQuit: FnMut(&A) -> bool,
FEffect: FnMut(E, &mut EffectContext<'_, A>),
pub async fn run_with_bus<B, FRender, FQuit, FEffect, Id, Ctx>(
&mut self,
terminal: &mut Terminal<B>,
bus: &mut EventBus<S, A, Id, Ctx>,
keybindings: &Keybindings<Ctx>,
render: FRender,
should_quit: FQuit,
handle_effect: FEffect,
) -> Result<(), Error>where
B: Backend,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
S: EventRoutingState<Id, Ctx>,
FRender: FnMut(&mut Frame<'_>, Rect, &S, RenderContext, &mut EventContext<Id>),
FQuit: FnMut(&A) -> bool,
FEffect: FnMut(E, &mut EffectContext<'_, A>),
Run the event/action loop using an EventBus for routing.
Auto Trait Implementations§
impl<S, A, E, St> Freeze for EffectRuntime<S, A, E, St>where
St: Freeze,
impl<S, A, E, St = EffectStore<S, A, E>> !RefUnwindSafe for EffectRuntime<S, A, E, St>
impl<S, A, E, St = EffectStore<S, A, E>> !Send for EffectRuntime<S, A, E, St>
impl<S, A, E, St = EffectStore<S, A, E>> !Sync for EffectRuntime<S, A, E, St>
impl<S, A, E, St> Unpin for EffectRuntime<S, A, E, St>
impl<S, A, E, St = EffectStore<S, A, E>> !UnwindSafe for EffectRuntime<S, A, E, St>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 more