Skip to main content

spawn

Function spawn 

Source
pub fn spawn<P, S, R, E, RV, F>(
    hbldr: impl FnOnce(&Client<P, S, R, E>) -> Result<F, E>,
) -> Result<(Client<P, S, R, E>, JoinHandle<Option<RV>>), E>
where P: 'static + Send, S: 'static + Send, R: 'static + Send, E: 'static + Send, RV: 'static + Send, F: Handler<P, S, R, E, RV> + Send + 'static,
Expand description

Launch a thread that will process incoming messages from an ump-ng server end-point.

hbldr is a closure that is expected to return the handler object that will be responsible for processing received messages.

See top module’s documentation for an overview of the dispatch loop and what the generic parameters are for.

§Errors

An application-defined error E is returned if the dispatch loop is terminated by a handler returning ControlFlow::Break(E).