Crate fs

source ·
Expand description

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");

Structs

  • A future representing work in the FsPool.
  • A pool of threads to handle file IO.
  • A Stream of bytes from a target file.
  • A Sink to send bytes to be written to a target file.
  • Options for how to read the file.
  • Options for how to write to the target file.