2018-08-27 12:24:51 -07:00
|
|
|
use futures::Future;
|
|
|
|
|
|
|
|
|
|
pub trait ForgetExt {
|
|
|
|
|
fn forget(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<F> ForgetExt for F
|
|
|
|
|
where F: Future + Sized + Send + 'static,
|
|
|
|
|
F::Item: Send,
|
|
|
|
|
F::Error: Send
|
|
|
|
|
{
|
|
|
|
|
fn forget(self) {
|
|
|
|
|
use std::thread;
|
|
|
|
|
thread::spawn(|| self.wait());
|
|
|
|
|
}
|
|
|
|
|
}
|