[][src]Crate async_ready

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

Example


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

struct Fut;

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

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

  fn poll_ready(
    mut self: Pin<&mut Self>,
    cx: &mut Context<'_>,
  ) -> 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.