Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

rustasync/async-ready

async-ready

crates.io version build status downloads docs.rs docs

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

Examples

Basic usage

#![feature(futures_api)]

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(()))
  }
}

Installation

$ cargo add async-ready

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

References

None.

License

MIT OR Apache-2.0

About

Async readiness traits

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages