【Rust日报】 2020-1-16 用 Rust 来诠释 Epoll, Kqueue 和 IOCP

本书以 Rust 语言解释 Epoll, Kqueue 和 IOCP 的工作原理,旨在提升 I/O 效率和性能。包含 Deadpool 异步池库的介绍和示例,以及受 Ruby's FactoryBot 启发的测试工厂库 factori 的使用。" 117603551,11104288,PyCharm中配置OpenCV环境并解决运行问题,"['python', 'opencv', 'PyCharm', '环境配置', '问题解决']
摘要由CSDN通过智能技术生成

用 Rust 来诠释 Epoll, Kqueue 和 IOCP

这其实是一本书,旨在说明 Epoll,Kqueue 和 IOCP 的工作原理,我们可以将其用于高效率、高性能的 I/O。其中一些实现将会使用 rust,原文地址:https://cfsamsonbooks.gitbook.io/epoll-kqueue-iocp-explained/

扩展阅读:Green Threads Explained in 200 Lines of Rust

reddit 上参与讨论:https://www.reddit.com/r/rust/comments/ephm4t/epoll_kqueue_and_iocp_explained_with_rust/

Deadpool

Deadpool 是一个死的简单异步池,用于任何类型的连接和对象。

Example
use async_trait::async_trait;

#[derive(Debug)]
enum Error { Fail }

struct Computer {}
struct Manager {}
type Pool = deadpool::managed::Pool<Computer, Error>;

impl Computer {
    async fn get_answer(&self) -> i32 {
        42
    }
}

#[async_trait]
impl deadpool::managed::Manager<Computer, Error> for Manager {
    async fn create(&self) -> Result&l
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值