[][src]Trait daemon_engine::AsyncWait

pub trait AsyncWait<I, E> {
    fn async_wait(self) -> Result<I, E>;
}

AsyncWait implements a .wait() equivalent that works from any contex. This is required because at some point in the past .wait() stopped doing this, and thus calling it in a polling context causes everything to lock up. see: https://github.com/tokio-rs/tokio-core/issues/182 and related issues.

// This will block forever if run in the main thread context
let _client = TcpConnection::<JsonCodec<Request, Response>>::new(&addr, JsonCodec::new()).wait().unwrap();
// This will work in the expected manner and return once connection has completed
let _client = TcpConnection::<JsonCodec<Request, Response>>::new(&addr, JsonCodec::new()).async_wait().unwrap();

Required methods

fn async_wait(self) -> Result<I, E>

Loading content...

Implementors

impl<F, I, E> AsyncWait<I, E> for F where
    F: Future<Item = I, Error = E> + Send + 'static,
    I: Send + 'static,
    E: Send + 'static, 
[src]

Loading content...