Enum HugePage
Source pub enum HugePage {
Static(MapHugeFlag),
Dynamic {
kilobytes: usize,
},
Smallest,
Largest,
Selected(for<'r> fn(&'r [usize]) -> Option<&'r usize>),
}
Expand description
Provides an arbitrary huge-page size and mapping flag for that size.
Can store or create a MAP_HUGE_*
flag for use with mmap()
, (MappedFile
) or memfd_create()
(file::MemoryFile::with_hugetlb()
)
§Usage
Main usage is for generating a MapHugeFlag
via compute_huge()
. This function may fail (rarely), so a TryInto
impl exists for MapHugeFlag
as well.
A staticly presented MAP_HUGE_*
flag. See MapHugeFlag
for details.
A dynamically calculated MAP_HUGE_*
flag from an arbitrary size in kB.
§Safety
The kernel must actually support huge-pages of this size.
If kilobytes
is 0, or an overflow in calculation happens, then this is identical to Smallest
.
The smallest huge-page size on the system
The largest huge-page size on the system
Use a callback function to select the huge-page size (in kB) from an ordered (lowest to highest) enumeration of all available on the system.
Compute the MapHugeFlag
from this huge-page specification.
§Returns
None
- If there was an error in computing the correct flag.
Some
- If the computation was successful.
§Panics
In debug builds, if scanning the system for huge-pages fails after SYSTEM_HUGEPAGES
has already failed.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
The type returned in the event of a conversion error.
Performs the conversion.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit
)
Performs copy-assignment from
self
to
dest
.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.