#fs-file #future #file #async #file-io

fs

文件系统操作的未来实现

1 个不稳定版本

使用旧的 Rust 2015

0.0.5 2019年6月7日

#49 in #fs-file

Download history 300/week @ 2024-03-13 405/week @ 2024-03-20 407/week @ 2024-03-27 385/week @ 2024-04-03 339/week @ 2024-04-10 365/week @ 2024-04-17 380/week @ 2024-04-24 337/week @ 2024-05-01 359/week @ 2024-05-08 389/week @ 2024-05-15 354/week @ 2024-05-22 400/week @ 2024-05-29 373/week @ 2024-06-05 334/week @ 2024-06-12 340/week @ 2024-06-19 359/week @ 2024-06-26

1,466 每月下载量
17 个crates (6 直接) 中使用

MIT/Apache

18KB
387

fs

Travis Build Status crates.io docs.rs

重新发布自 [futures-fs](https://github.com/seanmonstar/futures-fs),通过 FutureStream 在线程外访问文件系统操作。

用法

let fs = FsPool::default();

// our source file
let read = fs.read("/home/sean/foo.txt", Default::default());

// default writes options to create a new file
let write = fs.write("/home/sean/out.txt", Default::default());

// block this thread!
// the reading and writing however will happen off-thread
read.forward(write).wait()
    .expect("IO error piping foo.txt to out.txt");

lib.rs:

一个线程池来处理文件I/O操作。

示例

extern crate futures;
extern crate futures_fs;

use futures::{Future, Stream};
use futures_fs::FsPool;

let fs = FsPool::default();

// our source file
let read = fs.read("/home/sean/foo.txt", Default::default());

// default writes options to create a new file
let write = fs.write("/home/sean/out.txt", Default::default());

// block this thread!
// the reading and writing however will happen off-thread
read.forward(write).wait()
    .expect("IO error piping foo.txt to out.txt");

依赖项

~490KB