pub(crate) struct Layout {
size: usize,
align: usize,
}Expand description
A version of alloc::alloc::Layout that can be used in the const
position.
Fields§
§size: usize§align: usizeImplementations§
Source§impl Layout
impl Layout
Sourcepub(crate) const fn from_size_align(size: usize, align: usize) -> Self
pub(crate) const fn from_size_align(size: usize, align: usize) -> Self
Creates a new Layout with the given size and alignment.
Sourcepub(crate) const unsafe fn into_std(self) -> StdLayout
pub(crate) const unsafe fn into_std(self) -> StdLayout
Convert this into the standard library’s layout type.
§Safety
alignmust be non-zero and a power of two.- When rounded up to the nearest multiple of
align, the size must not overflow.
Sourcepub(crate) const fn extend(self, other: Layout) -> Option<(Layout, usize)>
pub(crate) const fn extend(self, other: Layout) -> Option<(Layout, usize)>
Returns the layout for a followed by b and the offset of b.
This function was adapted from the Layout::extend():
https://doc.rust-lang.org/nightly/std/alloc/struct.Layout.html#method.extend
Sourcepub(crate) const fn padding_needed_for(self, align: usize) -> usize
pub(crate) const fn padding_needed_for(self, align: usize) -> usize
Returns the padding after layout that aligns the following address to align.
This function was adapted from the Layout::padding_needed_for():
https://doc.rust-lang.org/nightly/std/alloc/struct.Layout.html#method.padding_needed_for
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
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