blob: 16634b1f2e61c8e0f015550062bd481f8602798c [file] [log] [blame]
use futures::executor::block_on;
use futures::future::Future;
use std::thread;
pub trait RunInBackgroundExt {
fn run_in_background(self);
}
impl<F> RunInBackgroundExt for F
where F: Future + Sized + Send + 'static,
F::Output: Send,
{
fn run_in_background(self) {
thread::spawn(|| block_on(self));
}
}