Struct relm4::component::worker::WorkerHandle
source · pub struct WorkerHandle<W: Component> { /* private fields */ }
Expand description
Handle to a worker task in the background
Implementations§
source§impl<W: Component> WorkerHandle<W>where
W::Input: 'static,
W::Output: 'static,
impl<W: Component> WorkerHandle<W>where
W::Input: 'static,
W::Output: 'static,
sourcepub fn connect_receiver<F: FnMut(&mut Sender<W::Input>, W::Output) + 'static>(
self,
func: F
) -> WorkerController<W>
pub fn connect_receiver<F: FnMut(&mut Sender<W::Input>, W::Output) + 'static>(
self,
func: F
) -> WorkerController<W>
Given a mutable closure, captures the receiver for handling.
sourcepub fn forward<X: 'static, F: Fn(W::Output) -> X + 'static>(
self,
sender: &Sender<X>,
transform: F
) -> WorkerController<W>
pub fn forward<X: 'static, F: Fn(W::Output) -> X + 'static>(
self,
sender: &Sender<X>,
transform: F
) -> WorkerController<W>
Forwards output events to the designated sender.
sourcepub fn detach(self) -> WorkerController<W>
pub fn detach(self) -> WorkerController<W>
Ignore outputs from the component and take the handle.