hypersync-client 1.1.4

client library for hypersync
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use tokio::sync::oneshot;

pub fn spawn<F, T>(func: F) -> oneshot::Receiver<T>
where
    F: 'static + FnOnce() -> T + Send,
    T: 'static + Send + Sync,
{
    let (tx, rx) = oneshot::channel();

    rayon::spawn(move || {
        let res = func();
        tx.send(res).ok();
    });

    rx
}