tiverse_mmap/
lib.rs

1//! # mmap-rs — Modern Memory-Mapped File Library for Rust
2//!
3//! A safe, performant, and ergonomic memory-mapped file I/O library that leverages
4//! modern Rust features and OS capabilities.
5//!
6//! ## Features
7//!
8//! - **Safe by default**: Zero `unsafe` in public API
9//! - **Cross-platform**: Full Linux/Windows/macOS/BSD support
10//! - **Type-safe builders**: Compile-time validation
11//! - **Modern Rust**: Edition 2021+, MSRV 1.70
12//! - **High performance**: Zero-cost abstractions, huge pages, prefaulting
13//!
14//! ## Quick Start
15//!
16//! ```ignore
17//! // TODO: This example will work once Phase 1 is complete
18//! use mmap_rs::MmapOptions;
19//!
20//! // Read-only mapping
21//! let mmap = MmapOptions::new()
22//!     .path("data.bin")
23//!     .map_readonly()?;
24//!
25//! let data: &[u8] = &mmap;
26//! # Ok::<(), Box<dyn std::error::Error>>(())
27//! ```
28//!
29//! ## Safety
30//!
31//! All public APIs are 100% safe Rust. Internal platform-specific code uses
32//! `unsafe` but is carefully audited and documented.
33
34#![warn(missing_docs)]
35#![warn(rust_2018_idioms)]
36#![deny(unsafe_op_in_unsafe_fn)]
37
38// Public modules
39mod advice;
40mod builder;
41pub mod error;
42mod file_lock;
43mod huge_pages;
44mod mmap;
45mod protection;
46mod slice;
47
48#[cfg(feature = "numa")]
49pub mod numa;
50
51#[cfg(feature = "async")]
52mod async_mmap;
53
54// Platform-specific implementation
55pub mod platform;
56
57// Re-exports for public API
58pub use advice::MemoryAdvice;
59pub use builder::{HasPath, MmapOptions, NoPath};
60pub use error::MmapError;
61pub use file_lock::{FileLock, LockType};
62pub use huge_pages::HugePageSize;
63pub use mmap::{CopyOnWrite, Mmap, ReadOnly, ReadWrite};
64pub use protection::Protection;
65pub use slice::MmapSlice;
66
67#[cfg(unix)]
68pub use platform::MappingMode;
69
70#[cfg(feature = "async")]
71pub use async_mmap::AsyncMmap;
72
73/// Result type alias for mmap operations
74pub type Result<T> = std::result::Result<T, MmapError>;