pub struct MmapChoice(/* private fields */);
Expand description

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.

Implementations§

source§

impl MmapChoice

source

pub unsafe fn auto() -> MmapChoice

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.

source

pub fn never() -> MmapChoice

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

Trait Implementations§

source§

impl Clone for MmapChoice

source§

fn clone(&self) -> MmapChoice

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MmapChoice

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for MmapChoice

source§

fn default() -> MmapChoice

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.