Struct relm4::component::AsyncConnector
source · pub struct AsyncConnector<C: AsyncComponent> { /* private fields */ }
Expand description
Contains the post-launch input sender and output receivers with the root widget.
The receiver can be separated from the Fairing
by choosing a method for handling it.
Implementations§
source§impl<C: AsyncComponent> AsyncConnector<C>
impl<C: AsyncComponent> AsyncConnector<C>
sourcepub fn forward<X: 'static, F: Fn(C::Output) -> X + 'static>(
self,
sender_: &Sender<X>,
transform: F
) -> AsyncController<C>
pub fn forward<X: 'static, F: Fn(C::Output) -> X + 'static>( self, sender_: &Sender<X>, transform: F ) -> AsyncController<C>
Forwards output events to the designated sender.
sourcepub fn connect_receiver<F: FnMut(&mut Sender<C::Input>, C::Output) + 'static>(
self,
func: F
) -> AsyncController<C>
pub fn connect_receiver<F: FnMut(&mut Sender<C::Input>, C::Output) + 'static>( self, func: F ) -> AsyncController<C>
Given a mutable closure, captures the receiver for handling.
sourcepub fn detach(self) -> AsyncController<C>
pub fn detach(self) -> AsyncController<C>
Ignore outputs from the component and take the handle.
Trait Implementations§
source§impl<C: AsyncComponent> AsyncComponentController<C> for AsyncConnector<C>
impl<C: AsyncComponent> AsyncComponentController<C> for AsyncConnector<C>
source§fn detach_runtime(&mut self)
fn detach_runtime(&mut self)
Dropping this type will usually stop the runtime of the component.
With this method you can give the runtime a static lifetime.
In other words, dropping the controller or connector will not stop
the runtime anymore, instead it will run until the app is closed.