Expand description
§mmap-rs — Modern Memory-Mapped File Library for Rust
A safe, performant, and ergonomic memory-mapped file I/O library that leverages modern Rust features and OS capabilities.
§Features
- Safe by default: Zero
unsafein public API - Cross-platform: Full Linux/Windows/macOS/BSD support
- Type-safe builders: Compile-time validation
- Modern Rust: Edition 2021+, MSRV 1.70
- High performance: Zero-cost abstractions, huge pages, prefaulting
§Quick Start
ⓘ
// TODO: This example will work once Phase 1 is complete
use mmap_rs::MmapOptions;
// Read-only mapping
let mmap = MmapOptions::new()
.path("data.bin")
.map_readonly()?;
let data: &[u8] = &mmap;§Safety
All public APIs are 100% safe Rust. Internal platform-specific code uses
unsafe but is carefully audited and documented.
Re-exports§
pub use error::MmapError;pub use platform::MappingMode;
Modules§
- error
- Error types for mmap operations.
- numa
- NUMA (Non-Uniform Memory Access) awareness for optimized memory placement.
- platform
- Platform-specific memory mapping implementations.
Structs§
- Async
Mmap - Async wrapper for memory-mapped files
- Copy
OnWrite - Phantom type for copy-on-write access
- File
Lock - File lock guard that automatically releases the lock when dropped
- HasPath
- Type state: path has been set
- Mmap
- A memory-mapped region with type-safe access control.
- Mmap
Options - Builder for creating memory-mapped regions.
- Mmap
Slice - A lifetime-bound reference to a sub-region of a memory-mapped file.
- NoPath
- Type state: no path set yet
- Protection
- Memory protection flags controlling access permissions.
- Read
Only - Phantom type for read-only access
- Read
Write - Phantom type for read-write access
Enums§
- Huge
Page Size - Huge page size options.
- Lock
Type - Type of file lock
- Memory
Advice - Memory advice hints to optimize I/O performance.
Type Aliases§
- Result
- Result type alias for mmap operations