pub enum MmapHints {
Eager,
Lazy,
}Expand description
Controls mmap prefault strategy for read_file_with_hints.
Different tools benefit from different page-fault strategies:
- Eager (default):
POPULATE_READprefaults all pages upfront, best when the entire file will be processed and startup latency is acceptable. - Lazy: skips
POPULATE_READ, lets pages fault on demand during SIMD scans. Best for tools likenlwhere memchr overlaps with lazy faults, avoiding the ~2ms upfront populate cost on 10MB files.
Both modes always apply HugePage (>= 2MB) and Sequential.
WillNeed is applied for files in the 1-4MB range in both modes, and as a
fallback for PopulateRead failure in Eager mode.
Variants§
Eager
Prefault pages eagerly via POPULATE_READ (or WillNeed fallback).
Lazy
Let pages fault lazily during access. Still applies WillNeed for 1-4MB files where lazy faults won’t overlap with processing.
Trait Implementations§
impl Copy for MmapHints
impl Eq for MmapHints
impl StructuralPartialEq for MmapHints
Auto Trait Implementations§
impl Freeze for MmapHints
impl RefUnwindSafe for MmapHints
impl Send for MmapHints
impl Sync for MmapHints
impl Unpin for MmapHints
impl UnsafeUnpin for MmapHints
impl UnwindSafe for MmapHints
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more