Crates.io | ready |
lib.rs | ready |
version | 1.1.0 |
source | src |
created_at | 2019-03-07 21:30:37.444846 |
updated_at | 2019-03-07 22:00:58.44388 |
description | Async ready states. |
homepage | |
repository | https://github.com/yoshuawuyts/ready |
max_upload_size | |
id | 119374 |
size | 33,822 |
Async readiness traits. Useful when implementing async state machines that can later be wrapped in dedicated futures.
Basic usage
#![feature(futures_api)]
use std::pin::Pin;
use std::task::{Poll, Waker};
use futures::prelude::*;
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 ready::Ready for Fut {
type Ok = ();
type Err = io::Error;
fn poll_ready(&self, waker: &Waker)
-> Poll<Result<Self::Ok, Self::Err>> {
Poll::Ready(Ok(()))
}
}
$ cargo add ready
This crate uses #![deny(unsafe_code)]
to ensure everything is implemented in
100% Safe Rust.
Want to join us? Check out our "Contributing" guide and take a look at some of these issues:
None.
MIT OR Apache-2.0