pub struct DispatchRuntime<S, A, St = Store<S, A>>where
A: Action,
St: DispatchStore<S, A>,{ /* private fields */ }Expand description
Runtime helper for simple stores (no effects).
Implementations§
Source§impl<S, A> DispatchRuntime<S, A>where
S: 'static,
A: Action,
impl<S, A> DispatchRuntime<S, A>where
S: 'static,
A: Action,
Source§impl<S, A, St> DispatchRuntime<S, A, St>where
S: 'static,
A: Action,
St: DispatchStore<S, A>,
impl<S, A, St> DispatchRuntime<S, A, St>where
S: 'static,
A: Action,
St: DispatchStore<S, A>,
Sourcepub fn from_store(store: St) -> DispatchRuntime<S, A, St>
pub fn from_store(store: St) -> DispatchRuntime<S, A, St>
Create a runtime from an existing store.
Sourcepub fn with_debug<D>(self, debug: D) -> DispatchRuntime<S, A, St>where
D: DebugAdapter<S, A>,
pub fn with_debug<D>(self, debug: D) -> DispatchRuntime<S, A, St>where
D: DebugAdapter<S, A>,
Attach a debug layer.
Sourcepub fn with_event_poller(
self,
config: PollerConfig,
) -> DispatchRuntime<S, A, St>
pub fn with_event_poller( self, config: PollerConfig, ) -> DispatchRuntime<S, A, St>
Configure event polling behavior.
Sourcepub fn with_dispatch_error_handler<F>(
self,
handler: F,
) -> DispatchRuntime<S, A, St>
pub fn with_dispatch_error_handler<F>( self, handler: F, ) -> DispatchRuntime<S, A, St>
Configure handling for recoverable dispatch errors.
The handler receives each DispatchError and selects a
DispatchErrorPolicy. Runtimes do not log or store errors by default;
do that inside this closure when needed.
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, R>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
map_event: FEvent,
should_quit: FQuit,
) -> Result<(), Error>
pub async fn run<B, FRender, FEvent, FQuit, R>( &mut self, terminal: &mut Terminal<B>, render: FRender, map_event: FEvent, should_quit: FQuit, ) -> Result<(), Error>
Run the event/action loop until quit.
Sourcepub async fn run_with_bus<B, FRender, FQuit, Id, Ctx>(
&mut self,
terminal: &mut Terminal<B>,
bus: &mut EventBus<S, A, Id, Ctx>,
keybindings: &Keybindings<Ctx>,
render: FRender,
should_quit: FQuit,
) -> 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,
pub async fn run_with_bus<B, FRender, FQuit, Id, Ctx>(
&mut self,
terminal: &mut Terminal<B>,
bus: &mut EventBus<S, A, Id, Ctx>,
keybindings: &Keybindings<Ctx>,
render: FRender,
should_quit: FQuit,
) -> 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,
Run the event/action loop using an EventBus for routing.
Auto Trait Implementations§
impl<S, A, St> Freeze for DispatchRuntime<S, A, St>where
St: Freeze,
impl<S, A, St = Store<S, A>> !RefUnwindSafe for DispatchRuntime<S, A, St>
impl<S, A, St = Store<S, A>> !Send for DispatchRuntime<S, A, St>
impl<S, A, St = Store<S, A>> !Sync for DispatchRuntime<S, A, St>
impl<S, A, St> Unpin for DispatchRuntime<S, A, St>
impl<S, A, St> UnsafeUnpin for DispatchRuntime<S, A, St>where
St: UnsafeUnpin,
impl<S, A, St = Store<S, A>> !UnwindSafe for DispatchRuntime<S, A, 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