pub struct PageLayout(/* private fields */);
Expand description
Layout of a range of pages.
This is analogous to Layout
, but requires the size and alignment to refer to whole pages.
Implementations§
Source§impl PageLayout
impl PageLayout
Sourcepub const fn from_size_align(
size: usize,
align: usize,
) -> Result<Self, PageLayoutError>
pub const fn from_size_align( size: usize, align: usize, ) -> Result<Self, PageLayoutError>
Constructs a PageLayout
from a given size
and align
,
or returns PageLayoutError
if any of the following conditions
are not met:
-
align
must not be zero, -
align
must be a power of two, -
size
, when rounded up to the nearest multiple ofalign
, must not overflow isize (i.e., the rounded value must be less than or equal toisize::MAX
), -
size
andalign
must both be aligned toPAGE_SIZE
.
Sourcepub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self
pub const unsafe fn from_size_align_unchecked(size: usize, align: usize) -> Self
Creates a page layout, bypassing all checks.
§Safety
This function is unsafe as it does not verify the preconditions from PageLayout::from_size_align
.
Sourcepub const fn from_size(size: usize) -> Result<Self, PageLayoutError>
pub const fn from_size(size: usize) -> Result<Self, PageLayoutError>
Creates a page layout with PAGE_SIZE
alignment.
Trait Implementations§
Source§impl Clone for PageLayout
impl Clone for PageLayout
Source§fn clone(&self) -> PageLayout
fn clone(&self) -> PageLayout
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PageLayout
impl Debug for PageLayout
Source§impl From<PageLayout> for Layout
impl From<PageLayout> for Layout
Source§fn from(value: PageLayout) -> Self
fn from(value: PageLayout) -> Self
Converts to this type from the input type.
Source§impl Hash for PageLayout
impl Hash for PageLayout
Source§impl PartialEq for PageLayout
impl PartialEq for PageLayout
Source§impl TryFrom<Layout> for PageLayout
impl TryFrom<Layout> for PageLayout
impl Copy for PageLayout
impl Eq for PageLayout
impl StructuralPartialEq for PageLayout
Auto Trait Implementations§
impl Freeze for PageLayout
impl RefUnwindSafe for PageLayout
impl Send for PageLayout
impl Sync for PageLayout
impl Unpin for PageLayout
impl UnwindSafe for PageLayout
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