pub struct Align { /* private fields */ }Expand description
This type is basically a copy of the Align type in the Rust compiler.
See Align.
Implementations§
source§impl Align
impl Align
sourcepub fn from_bytes(align: impl Into<Int>) -> Option<Align>
pub fn from_bytes(align: impl Into<Int>) -> Option<Align>
Constructs Align with align many bytes.
Returns None if align is not a power of two.
sourcepub const fn from_bytes_const(align: u64) -> Option<Align>
pub const fn from_bytes_const(align: u64) -> Option<Align>
Variation of from_bytes for const contexts.
sourcepub fn from_bits(align: impl Into<Int>) -> Option<Align>
pub fn from_bits(align: impl Into<Int>) -> Option<Align>
Constructs Align with align many bits.
Returns None if align is not divisible by 8, or if align/8 is no power of two.
sourcepub const fn from_bits_const(align: u64) -> Option<Align>
pub const fn from_bits_const(align: u64) -> Option<Align>
Variation of from_bits for const contexts.
sourcepub fn max_for_offset(offset: Size) -> Option<Align>
pub fn max_for_offset(offset: Size) -> Option<Align>
Computes the best alignment possible for the given offset
(the largest power of two that the offset is a multiple of).
For an offset of 0 it returns None.
sourcepub fn restrict_for_offset(self, offset: Size) -> Align
pub fn restrict_for_offset(self, offset: Size) -> Align
Lower the alignment if necessary, such that the given offset is aligned to it (the offset is a multiple of the alignment).
Trait Implementations§
source§impl Ord for Align
impl Ord for Align
source§impl PartialEq<Align> for Align
impl PartialEq<Align> for Align
source§impl PartialOrd<Align> for Align
impl PartialOrd<Align> for Align
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more