pub struct Align { /* private fields */ }
Expand description
Alignment of a type in bytes (always a power of two).
Implementations§
Source§impl Align
impl Align
pub const ONE: Align = _
pub const EIGHT: Align = _
pub const MAX: Align = _
pub fn from_bits(bits: u64) -> Result<Align, AlignFromBytesError>
pub const fn from_bytes(align: u64) -> Result<Align, AlignFromBytesError>
pub fn bytes(self) -> u64
pub fn bytes_usize(self) -> usize
pub fn bits(self) -> u64
pub fn bits_usize(self) -> usize
Sourcepub fn max_for_offset(offset: Size) -> Align
pub fn max_for_offset(offset: Size) -> Align
Computes the best alignment possible for the given offset (the largest power of two that the offset is a multiple of).
N.B., for an offset of 0
, this happens to return 2^64
.
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 PartialOrd for Align
impl PartialOrd for Align
impl Copy for Align
impl Eq for Align
impl StructuralPartialEq for Align
Auto Trait Implementations§
impl Freeze for Align
impl RefUnwindSafe for Align
impl Send for Align
impl Sync for Align
impl Unpin for Align
impl UnwindSafe for Align
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