- Rust 100%
| .github/workflows | Switch CI from AppVeyor to GitHub Actions | |
| examples | Replace rust-crypto crate with sha2 | |
| src | Replace usage of try! with ? operator | |
| .gitignore | Put Cargo.lock under source control | |
| build.rcl | Switch CI from AppVeyor to GitHub Actions | |
| Cargo.lock | Bump version to 1.0.1 | |
| Cargo.toml | Bump version to 1.0.1 | |
| changelog.md | Bump version to 1.0.1 | |
| contributing.md | Ban the use of LLMs in the issue tracker | |
| license | License project under the Apache License 2.0 | |
| readme.md | Remove badges from Cargo config and readme | |
| rust-toolchain.toml | Switch CI from AppVeyor to GitHub Actions | |
Filebuffer
Fast and simple file reading for Rust.
Crates.io version Changelog Documentation
Filebuffer can map files into memory. This is often faster than using the
primitives in std::io, and also more convenient. Furthermore this crate
offers prefetching and checking whether file data is resident in physical
memory (so access will not incur a page fault). This enables non-blocking
file reading.
Example
Below is an implementation of the sha256sum program that is both faster and
simpler than the naive std::io equivalent. (See sha256sum_filebuffer and
sha256sum_naive in the examples directory.)
usestd::env;usecrypto::digest::Digest;usecrypto::sha2::Sha256;usefilebuffer::FileBuffer;externcratecrypto;externcratefilebuffer;fn main(){forfnameinenv::args().skip(1){letfbuffer=FileBuffer::open(&fname).expect("failed to open file");letmuthasher=Sha256::new();hasher.input(&fbuffer);println!("{}{}",hasher.result_str(),fname);}}License
Filebuffer is licensed under the Apache 2.0 license. It may be used in free software as well as closed-source applications, both for commercial and non-commercial use under the conditions given in the license. If you want to use Filebuffer in your GPLv2-licensed software, you can add an exception to your copyright notice.