6个稳定版本

3.0.0 2019年5月15日
2.1.0 2019年4月16日
2.0.1 2019年4月15日
2.0.0 2019年3月8日
1.0.1 2019年3月8日

2095异步

Download history 193/week @ 2024-03-30 120/week @ 2024-04-06 153/week @ 2024-04-13 161/week @ 2024-04-20 139/week @ 2024-04-27 143/week @ 2024-05-04 149/week @ 2024-05-11 139/week @ 2024-05-18 144/week @ 2024-05-25 165/week @ 2024-06-01 105/week @ 2024-06-08 147/week @ 2024-06-15 185/week @ 2024-06-22 105/week @ 2024-06-29 103/week @ 2024-07-06 145/week @ 2024-07-13

558 每月下载量
用于 12 个crate(直接使用3个)

MIT/Apache

14KB
104

async-ready

crates.io version build status downloads docs.rs docs

异步就绪特质。在实现可随后封装为专用futures的异步状态机时很有用。

示例

基本用法

#![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(()))
  }
}

安装

$ cargo add async-ready

安全性

此crate使用#![deny(unsafe_code)]来确保所有内容都在100%安全的Rust中实现。

贡献

想加入我们?查看我们的"贡献"指南并查看一些这些问题

参考文献

无。

许可证

MIT OR Apache-2.0

无运行时依赖