Registry / utility / memmap2

memmap2

JSON →
library0.9.10rscratesunverified

Cross-platform Rust API for memory-mapped file IO

# Cargo.toml [dependencies] memmap2 = "0.9.10"
INSTALL
IMPORT
SIG · MEMMAP2
M
memmap2
utilityrustv0.9.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Mmap
✓ use memmap2::Mmap;

Memory-map a file and read its contents.

use memmap2::Mmap; use std::fs::File; fn main() -> std::io::Result<()> { let file = File::open("example.txt")?; let mmap = unsafe { Mmap::map(&file)? }; println!("{:?}", &mmap[..10]); Ok(()) }
Debug
Known issues
gotchaMmap::map is unsafe because it can cause undefined behavior if the underlying file is mutated concurrently.
fix
Ensure the file is not modified while the mapping exists, or use `Mmap::map_readonly` for read-only access.
affects: >=0.1.0
Upgrade
Version history
0.9.10latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
memmap2 — cargo add memmap2 · libregistry