1 unstable release
Uses old Rust 2015
0.0.5 | Jun 7, 2019 |
---|
#49 in #fs-file
1,466 downloads per month
Used in 17 crates
(6 directly)
18KB
387 lines
fs
Re-published from [futures-fs](https://github.com/seanmonstar/futures-fs)
, access File System operations off-thread, using Future
s and Stream
s.
Usage
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
:
A thread pool to handle file IO operations.
Examples
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");
Dependencies
~490KB