You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Cargo.toml
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,23 @@
1
1
[package]
2
2
name = "mmap-io"
3
-
version = "0.9.7"
3
+
version = "0.9.8"
4
4
edition = "2021"
5
5
rust-version = "1.75"
6
6
readme = "README.md"
7
7
license = "Apache-2.0"
8
8
publish = true
9
-
description = "High-performance, async-ready memory-mapped file I/O library for Rust. Supports fast segment-based loading, updates, and persistence. Designed for database engines, game runtimes, and real-time applications."
9
+
description = "Zero-copy memory-mapped file I/O for Rust. Safe concurrent reads, writes, and atomic views across Linux, macOS, and Windows. Built for databases, log structures, game runtimes, caches, and IPC."
-**Zero-copy reads on every mode.**`as_slice` returns a `MappedSlice<'_>` borrowed directly from the mapping. No allocation. No memcpy. Works on read-only, read-write, and copy-on-write mappings uniformly.
27
+
-**Zero-allocation iteration.**`mmap.chunks(N)` and `mmap.pages()` walk the file in fixed strides without ever heap-allocating. A 1 GiB scan at 4 KiB chunks skips 262,144 allocations and half the memory bandwidth of the naive approach.
28
+
-**Aligned atomic views.**`atomic_u32` / `atomic_u64` return a wrapper that derefs to `&AtomicU64`. Multi-thread `fetch_add` over a memory-mapped counter is one cache-line ping; no cross-process locking required.
29
+
-**Configurable durability.**`FlushPolicy::EveryBytes(N)`, `EveryWrites(N)`, `EveryMillis(N)`, `Always`, or `Manual`. The accumulator is correctly debited on partial flushes (audit C1) and the millis policy actually runs a background flusher (audit C2).
30
+
-**Thread-safe.** Interior mutability via `parking_lot::RwLock`. Multiple concurrent readers, one writer at a time. Live atomic views block `resize()` until released so memory under your reference cannot move (audit C3).
31
+
-**Cross-platform.** Linux, macOS, Windows. Per-platform fast paths (`MS_ASYNC` flush on Linux, `MADV_HUGEPAGE` on huge-page hints, `posix_fadvise` for OS-level prefetch).
32
+
-**Opt-in surface.** Default features are `advise` + `iterator`. Everything else (`async`, `atomic`, `cow`, `locking`, `watch`, `hugepages`) is off by default to keep compile time tight.
33
+
-**MSRV: 1.75.** Pinned and verified in CI.
36
34
37
35
## Quick start
38
36
@@ -45,26 +43,28 @@ mmap-io = "0.9"
45
43
usemmap_io::MemoryMappedFile;
46
44
47
45
fnmain() ->Result<(), mmap_io::MmapIoError> {
48
-
// Open an existing file in read-only mode
46
+
// Open an existing file in read-only mode.
49
47
letmmap=MemoryMappedFile::open_ro("data.bin")?;
50
48
51
-
// Zero-copy read of the first 16 bytes
49
+
// Zero-copy read of the first 16 bytes. `slice` derefs to &[u8].
52
50
letslice=mmap.as_slice(0, 16)?;
53
-
println!("First bytes: {slice:?}");
51
+
println!("First bytes: {:?}", &*slice);
54
52
55
53
Ok(())
56
54
}
57
55
```
58
56
59
-
Or write a fresh file:
57
+
Open-or-create with one call:
60
58
61
59
```rust
62
-
usemmap_io::{create_mmap, update_region, flush};
60
+
usemmap_io::MemoryMappedFile;
63
61
64
62
fnmain() ->Result<(), mmap_io::MmapIoError> {
65
-
letmmap=create_mmap("data.bin", 1024*1024)?;
66
-
update_region(&mmap, 100, b"Hello, mmap!")?;
67
-
flush(&mmap)?;
63
+
// Opens "data.bin" if it exists; creates it at 1 MiB otherwise.
0 commit comments