#[repr(C)]pub struct Layout {
pub size: usize,
pub align: usize,
}Expand description
ABI-stable equivalent of std::mem::Layout
Fields§
§size: usizeThe expected size of the allocation.
align: usizeThe expected alignment of the allocation.
Implementations§
Source§impl Layout
impl Layout
Sourcepub const fn has_optimal_layout() -> bool
pub const fn has_optimal_layout() -> bool
Returns true if the layout for Layout is smaller or equal to that Rust would have generated for it.
Source§impl Layout
impl Layout
Sourcepub const fn array<T: Sized>(n: usize) -> Self
pub const fn array<T: Sized>(n: usize) -> Self
Returns the Layout corresponding to [T; n].
Note that while this ensures that even if T’s size is not a multiple of its alignment,
the layout will have sufficient memory to store n of T in an aligned fashion.
Sourcepub const fn concat(self, other: Self) -> Self
pub const fn concat(self, other: Self) -> Self
Concatenates a layout to self, ensuring that alignment padding is taken into account.
Sourcepub fn next_matching<T>(self, ptr: *mut T) -> *mut T
pub fn next_matching<T>(self, ptr: *mut T) -> *mut T
Returns the first pointer where output >= ptr such that output % self.align == 0.
Trait Implementations§
Source§impl IStable for Layout
impl IStable for Layout
Source§const REPORT: &'static TypeReport
const REPORT: &'static TypeReport
A compile-time generated report of the fields of the type, allowing for compatibility inspection.
Source§const ID: u64 = 4_359_646_995_240_167_857u64
const ID: u64 = 4_359_646_995_240_167_857u64
A stable (and ideally unique) identifier for the type. Often generated using
crate::report::gen_id, but can be manually set.Source§type ForbiddenValues = <Struct<FieldPair<usize, usize>> as IStable>::ForbiddenValues
type ForbiddenValues = <Struct<FieldPair<usize, usize>> as IStable>::ForbiddenValues
The values that the annotated type cannot occupy.
Source§type UnusedBits = <Struct<FieldPair<usize, usize>> as IStable>::UnusedBits
type UnusedBits = <Struct<FieldPair<usize, usize>> as IStable>::UnusedBits
The padding bits in the annotated types
Source§type Size = <Struct<FieldPair<usize, usize>> as IStable>::Size
type Size = <Struct<FieldPair<usize, usize>> as IStable>::Size
The size of the annotated type in bytes.
Source§type Align = <Struct<FieldPair<usize, usize>> as IStable>::Align
type Align = <Struct<FieldPair<usize, usize>> as IStable>::Align
The alignment of the annotated type in bytes.
Source§type HasExactlyOneNiche = <Struct<FieldPair<usize, usize>> as IStable>::HasExactlyOneNiche
type HasExactlyOneNiche = <Struct<FieldPair<usize, usize>> as IStable>::HasExactlyOneNiche
Allows the detection of whether or not
core::option::Options are stable: Read moreSource§type ContainsIndirections = <Struct<FieldPair<usize, usize>> as IStable>::ContainsIndirections
type ContainsIndirections = <Struct<FieldPair<usize, usize>> as IStable>::ContainsIndirections
Whether or not the type contains indirections (pointers, indices in independent data-structures…)
Source§impl Ord for Layout
impl Ord for Layout
Source§impl PartialOrd for Layout
impl PartialOrd for Layout
impl Copy for Layout
impl Eq for Layout
impl StructuralPartialEq for Layout
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<Source> AccessAs for Source
impl<Source> AccessAs for Source
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IPod for T
impl<T> IPod for T
Source§fn identifier() -> u64
fn identifier() -> u64
Produces an identifier for the type, allowing to check type at runtime (barring collisions).