pub struct HostedRuntime<S, A, E, Id, Ctx, St = Store<S, A, E>>where
A: ActionTrait,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
S: EventRoutingState<Id, Ctx>,
St: RuntimeStore<S, A, E>,{ /* private fields */ }Expand description
Runtime wrapper that keeps ComponentHost area synchronization out of app loops.
Implementations§
Source§impl<S, A, E, Id, Ctx, St> HostedRuntime<S, A, E, Id, Ctx, St>where
S: 'static + EventRoutingState<Id, Ctx>,
A: ActionTrait,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
St: RuntimeStore<S, A, E>,
impl<S, A, E, Id, Ctx, St> HostedRuntime<S, A, E, Id, Ctx, St>where
S: 'static + EventRoutingState<Id, Ctx>,
A: ActionTrait,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
St: RuntimeStore<S, A, E>,
Sourcepub fn host(&self) -> &ComponentHost<S, A, Id, Ctx>
pub fn host(&self) -> &ComponentHost<S, A, Id, Ctx>
Access the hosted component host.
Sourcepub fn host_mut(&mut self) -> &mut ComponentHost<S, A, Id, Ctx>
pub fn host_mut(&mut self) -> &mut ComponentHost<S, A, Id, Ctx>
Access the hosted component host mutably.
Sourcepub fn runtime(&self) -> &ComponentHostRuntime<S, A, E, Id, Ctx, St>
pub fn runtime(&self) -> &ComponentHostRuntime<S, A, E, Id, Ctx, St>
Access the wrapped runtime.
Sourcepub fn runtime_mut(&mut self) -> &mut ComponentHostRuntime<S, A, E, Id, Ctx, St>
pub fn runtime_mut(&mut self) -> &mut ComponentHostRuntime<S, A, E, Id, Ctx, St>
Access the wrapped runtime mutably.
Sourcepub fn into_parts(self) -> HostedRuntimeParts<S, A, E, Id, Ctx, St>
pub fn into_parts(self) -> HostedRuntimeParts<S, A, E, Id, Ctx, St>
Split the wrapper back into its runtime and host.
Sourcepub fn keybindings(&self) -> &Keybindings<Ctx>
pub fn keybindings(&self) -> &Keybindings<Ctx>
Access keybindings.
Sourcepub fn keybindings_mut(&mut self) -> &mut Keybindings<Ctx>
pub fn keybindings_mut(&mut self) -> &mut Keybindings<Ctx>
Access keybindings mutably.
Sourcepub fn subscribe_actions(&self) -> Receiver<String>
pub fn subscribe_actions(&self) -> Receiver<String>
Subscribe to action name broadcasts.
Sourcepub fn action_tx(&self) -> UnboundedSender<A>
pub fn action_tx(&self) -> UnboundedSender<A>
Clone the action sender.
Source§impl<S, A, Id, Ctx, St> HostedRuntime<S, A, NoEffect, Id, Ctx, St>where
S: 'static + EventRoutingState<Id, Ctx>,
A: ActionTrait,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
St: RuntimeStore<S, A, NoEffect>,
impl<S, A, Id, Ctx, St> HostedRuntime<S, A, NoEffect, Id, Ctx, St>where
S: 'static + EventRoutingState<Id, Ctx>,
A: ActionTrait,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
St: RuntimeStore<S, A, NoEffect>,
Sourcepub async fn run<B, FRender, FQuit>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
should_quit: FQuit,
) -> Result<()>where
B: Backend,
FRender: FnMut(&mut Frame<'_>, Rect, &S, RenderContext, &mut EventContext<Id>),
FQuit: FnMut(&A) -> bool,
pub async fn run<B, FRender, FQuit>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
should_quit: FQuit,
) -> Result<()>where
B: Backend,
FRender: FnMut(&mut Frame<'_>, Rect, &S, RenderContext, &mut EventContext<Id>),
FQuit: FnMut(&A) -> bool,
Run the event/action loop and synchronize host-rendered areas after each frame.
Sourcepub async fn run_with_hooks<B, FRender, FQuit, FAfter>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
should_quit: FQuit,
after_render: FAfter,
) -> Result<()>
pub async fn run_with_hooks<B, FRender, FQuit, FAfter>( &mut self, terminal: &mut Terminal<B>, render: FRender, should_quit: FQuit, after_render: FAfter, ) -> Result<()>
Run the loop with a post-render hook after host area synchronization.
Source§impl<S, A, E, Id, Ctx, St> HostedRuntime<S, A, E, Id, Ctx, St>where
S: 'static + EventRoutingState<Id, Ctx>,
A: ActionTrait,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
St: RuntimeStore<S, A, E>,
impl<S, A, E, Id, Ctx, St> HostedRuntime<S, A, E, Id, Ctx, St>where
S: 'static + EventRoutingState<Id, Ctx>,
A: ActionTrait,
Id: ComponentId + 'static,
Ctx: BindingContext + 'static,
St: RuntimeStore<S, A, E>,
Sourcepub async fn run_with_effects<B, FRender, FQuit, FEffect>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
should_quit: FQuit,
handle_effect: FEffect,
) -> Result<()>where
B: Backend,
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_effects<B, FRender, FQuit, FEffect>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
should_quit: FQuit,
handle_effect: FEffect,
) -> Result<()>where
B: Backend,
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 with effects and host area synchronization.
Sourcepub async fn run_with_effect_hooks<B, FRender, FQuit, FEffect, FAfter>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
should_quit: FQuit,
handle_effect: FEffect,
after_render: FAfter,
) -> Result<()>where
B: Backend,
FRender: FnMut(&mut Frame<'_>, Rect, &S, RenderContext, &mut EventContext<Id>),
FQuit: FnMut(&A) -> bool,
FEffect: FnMut(E, &mut EffectContext<'_, A>),
FAfter: FnMut(&mut EventBus<S, A, Id, Ctx>, &S),
pub async fn run_with_effect_hooks<B, FRender, FQuit, FEffect, FAfter>(
&mut self,
terminal: &mut Terminal<B>,
render: FRender,
should_quit: FQuit,
handle_effect: FEffect,
after_render: FAfter,
) -> Result<()>where
B: Backend,
FRender: FnMut(&mut Frame<'_>, Rect, &S, RenderContext, &mut EventContext<Id>),
FQuit: FnMut(&A) -> bool,
FEffect: FnMut(E, &mut EffectContext<'_, A>),
FAfter: FnMut(&mut EventBus<S, A, Id, Ctx>, &S),
Run the loop with effects and a post-render hook after host area synchronization.
Auto Trait Implementations§
impl<S, A, E, Id, Ctx, St = Store<S, A, E>> !Freeze for HostedRuntime<S, A, E, Id, Ctx, St>
impl<S, A, E, Id, Ctx, St = Store<S, A, E>> !RefUnwindSafe for HostedRuntime<S, A, E, Id, Ctx, St>
impl<S, A, E, Id, Ctx, St = Store<S, A, E>> !Send for HostedRuntime<S, A, E, Id, Ctx, St>
impl<S, A, E, Id, Ctx, St = Store<S, A, E>> !Sync for HostedRuntime<S, A, E, Id, Ctx, St>
impl<S, A, E, Id, Ctx, St> Unpin for HostedRuntime<S, A, E, Id, Ctx, St>
impl<S, A, E, Id, Ctx, St> UnsafeUnpin for HostedRuntime<S, A, E, Id, Ctx, St>where
St: UnsafeUnpin,
impl<S, A, E, Id, Ctx, St = Store<S, A, E>> !UnwindSafe for HostedRuntime<S, A, E, Id, Ctx, 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> 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