(port: i64, parse_params: F, async_job: F2)
where
P: 'static + Send + Sync,
F: FnOnce() -> Result,
F2: 'static + Send + Sync + FnOnce(P) -> R,
DartRes: From,
{
match parse_params() {
Ok(parsed_params) => {
if THREAD_POOL
.launch(move |_| Isolate::new(port).post(DartRes::from(async_job(parsed_params))))
.is_err()
{
Isolate::new(port).post(DartRes::err("thread pool panicked"));
}
}
Err(e) => {
Isolate::new(port).post(DartRes::err(e));
}
}
}