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

futures-fs

文件系统操作的Futures实现

6个版本

使用旧的Rust 2015

0.0.5 2018年10月9日
0.0.4 2018年4月27日
0.0.3 2017年9月28日
0.0.2 2017年5月21日
0.0.0 2017年2月23日

#1040 in 文件系统

Download history 93/week @ 2024-03-30 69/week @ 2024-04-06 63/week @ 2024-04-13 115/week @ 2024-04-20 72/week @ 2024-04-27 69/week @ 2024-05-04 73/week @ 2024-05-11 126/week @ 2024-05-18 52/week @ 2024-05-25 54/week @ 2024-06-01 45/week @ 2024-06-08 65/week @ 2024-06-15 70/week @ 2024-06-22 70/week @ 2024-06-29 38/week @ 2024-07-06 63/week @ 2024-07-13

每月251次下载
4 个Crates中使用 (3 直接)

MIT/Apache

18KB
387

futures-fs

Travis Build Status crates.io docs.rs

使用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:

一个线程池来处理文件IO操作。

示例

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