| Crates.io | tiverse-mmap |
| lib.rs | tiverse-mmap |
| version | 1.0.0 |
| created_at | 2025-10-30 22:30:04.214727+00 |
| updated_at | 2025-10-30 22:30:04.214727+00 |
| description | Modern, safe, and ergonomic memory-mapped file I/O library with zero unsafe in public API |
| homepage | https://github.com/TIVerse/mmap-rs |
| repository | https://github.com/TIVerse/mmap-rs |
| max_upload_size | |
| id | 1909065 |
| size | 247,726 |
Next-Generation Memory-Mapped I/O with Safety, Performance, and Modern Rust Idioms
A safe, performant, and ergonomic memory-mapped file I/O library that becomes the new standard for high-performance file I/O in Rust.
unsafe in public API; all unsafe code isolated and auditedvs. memmap2:
vs. Manual libc calls:
unsafeAdd this to your Cargo.toml:
[dependencies]
tiverse-mmap = "1.0"
use mmap_rs::MmapOptions;
// Read-only mapping
let mmap = MmapOptions::new()
.path("data.bin")
.map_readonly()?;
let data: &[u8] = &mmap;
println!("First byte: {}", data[0]);
use mmap_rs::MmapOptions;
// Read-write mapping
let mut mmap = MmapOptions::new()
.path("data.bin")
.map_readwrite()?;
let data: &mut [u8] = &mut mmap;
data[0] = 42;
use mmap_rs::{MmapOptions, Protection, HugePageSize, PrefaultStrategy};
// High-performance mapping with huge pages and prefaulting
let mmap = MmapOptions::new()
.path("model.bin")
.protection(Protection::READ | Protection::WRITE)
.huge_pages(HugePageSize::Size2MB)
.prefault_strategy(PrefaultStrategy::Sequential)
.map()?;
memmap2mremap on Linux)Mmap type with RAIISee ROADMAP.md for the complete implementation plan.
# Run all tests
cargo test --all-features
# Run with miri for memory safety validation
cargo +nightly miri test
# Run benchmarks
cargo bench
# Check with clippy
cargo clippy --all-features -- -D warnings
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
# Clone the repository
git clone https://github.com/TIVerse/mmap-rs.git
cd mmap-rs
# Build and test
cargo build
cargo test --all-features
# Run benchmarks
cargo bench
Performance targets:
| Operation | tiverse-mmap | memmap2 | std::fs::read |
|---|---|---|---|
| 1GB Sequential Read | 1.2s | 1.3s | 2.8s |
| Random Access (1M ops) | 0.8s | 0.9s | N/A |
| Startup (map only) | 50ยตs | 80ยตs | 2.5s |
| Memory Usage | 200MB | 220MB | 1GB |
(Benchmarks will be conducted in Phase 4)
Licensed under either of:
at your option.
This project builds upon lessons learned from:
Special thanks to the Rust community for feedback and contributions.
Ready to build the new gold standard for memory-mapped I/O in Rust.