fs 0.0.6

Asynchronous filesystem operations on a dedicated blocking thread pool
Documentation
  • Coverage
  • 100%
    14 out of 14 items documented1 out of 10 items with examples
  • Size
  • Source code size: 40.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 891.1 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • liuchong/futures-fs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • liuchong

fs

CI Crates.io Documentation MSRV License

Asynchronous filesystem operations using futures 0.3. Blocking file I/O runs on a dedicated worker pool instead of the thread driving the futures.

Usage

use fs::FsPool;
use futures::executor::block_on;
use futures::StreamExt;
use std::io;

fn main() -> io::Result<()> {
    // Choose the number of threads reserved for blocking filesystem work.
    let fs = FsPool::new(4);

    block_on(async {
        let reader = fs.read("input.txt", Default::default());
        let writer = fs.write("output.txt", Default::default());

        reader.forward(writer).await
    })
}

FsReadStream yields io::Result<bytes::Bytes> chunks. FsWriteSink implements futures::Sink<bytes::Bytes>, and operations such as delete return futures that can be awaited directly.