Crate tiverse_mmap

Crate tiverse_mmap 

Source
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 unsafe in 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§

AsyncMmap
Async wrapper for memory-mapped files
CopyOnWrite
Phantom type for copy-on-write access
FileLock
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.
MmapOptions
Builder for creating memory-mapped regions.
MmapSlice
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.
ReadOnly
Phantom type for read-only access
ReadWrite
Phantom type for read-write access

Enums§

HugePageSize
Huge page size options.
LockType
Type of file lock
MemoryAdvice
Memory advice hints to optimize I/O performance.

Type Aliases§

Result
Result type alias for mmap operations