[][src]Crate async_ready

Async readiness traits. Useful when implementing async state machines that can later be wrapped in dedicated futures.

Example

#![feature(futures_api)]

use std::pin::Pin;
use std::task::{Poll, Waker};
use futures::prelude::*;
use async_ready::AsyncReady;
use std::io;

struct Fut;

impl Future for Fut {
  type Output = ();
  fn poll(self: Pin<&mut Self>, waker: &Waker) -> Poll<Self::Output> {
    Poll::Ready(())
  }
}

impl AsyncReady for Fut {
  type Ok = ();
  type Err = io::Error;

  fn poll_ready(&mut self, waker: &Waker)
    -> Poll<Result<Self::Ok, Self::Err>> {
    Poll::Ready(Ok(()))
  }
}

Traits

AsyncReadReady

Determine if the underlying API can be read from.

AsyncReady

Determine if a struct is async-ready to yield futures.

AsyncWriteReady

Determine if the underlying API can be written to.

TakeError

Extract an error from the underlying struct that isn't propagated through regular channels.