[][src]Struct grep_searcher::MmapChoice

pub struct MmapChoice(_);

Controls the strategy used for determining when to use memory maps.

If a searcher is called in circumstances where it is possible to use memory maps, and memory maps are enabled, then it will attempt to do so if it believes it will make the search faster.

By default, memory maps are disabled.

Methods

impl MmapChoice[src]

pub unsafe fn auto() -> MmapChoice[src]

Use memory maps when they are believed to be advantageous.

The heuristics used to determine whether to use a memory map or not may depend on many things, including but not limited to, file size and platform.

If memory maps are unavailable or cannot be used for a specific input, then normal OS read calls are used instead.

Safety

This constructor is not safe because there is no obvious way to encapsulate the safety of file backed memory maps on all platforms without simultaneously negating some or all of their benefits.

The specific contract the caller is required to uphold isn't precise, but it basically amounts to something like, "the caller guarantees that the underlying file won't be mutated." This, of course, isn't feasible in many environments. However, command line tools may still decide to take the risk of, say, a SIGBUS occurring while attempting to read a memory map.

pub fn never() -> MmapChoice[src]

Never use memory maps, no matter what. This is the default.

Trait Implementations

impl Clone for MmapChoice[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for MmapChoice[src]

impl Debug for MmapChoice[src]

Auto Trait Implementations

impl Send for MmapChoice

impl Sync for MmapChoice

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]