pub fn spawn_preinit<P, S, R, E, RV>(
    server: Server<P, S, R, E>,
    handler: impl Handler<P, S, R, E, RV> + Send + 'static
) -> JoinHandle<Option<RV>>
where P: 'static + Send, S: 'static + Send, R: 'static + Send, E: 'static + Send, RV: 'static + Send,
Expand description

Spawn a thread to run a pre-initialized handler.

It is assumed that the caller has initialized the handler, thus its init() method will not be called.

use std::ops::ControlFlow;
use ump_ng_server::{ump_ng, spawn_thread_preinit, ThreadedHandler,
  ReplyContext};
let (server, client) = ump_ng::channel::<(), (), (), ()>();

struct MyHandler {
  wclnt: ump_ng::WeakClient<(), (), (), ()>
}
impl ThreadedHandler<(), (), (), (), ()> for MyHandler {
  fn post(&mut self, _: ()) -> ControlFlow<(), ()> {
    ControlFlow::Continue(())
  }
  fn req(&mut self, _: (), rctx: ReplyContext<(), ()>)
    -> ControlFlow<(), ()> {
    ControlFlow::Continue(())
  }
}
let handler = MyHandler {
  wclnt: client.weak()
};
let jh = spawn_thread_preinit(server, handler);

// drop client to force dispatch loop to terminate
drop(client);

jh.join();