Trait Alignable

Source
pub trait Alignable {
    // Required method
    fn align_to(&self, alignment: Self) -> Self;
}
Expand description

Trait for aligning a numeric value to a given byte boundary

§Example

assert_eq!(8, 5_u32.align_to(8));

Required Methods§

Source

fn align_to(&self, alignment: Self) -> Self

Align the associated value to an alignment bytes boundary

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Alignable for u8

Source§

fn align_to(&self, alignment: Self) -> Self

Source§

impl Alignable for u16

Source§

fn align_to(&self, alignment: Self) -> Self

Source§

impl Alignable for u32

Source§

fn align_to(&self, alignment: Self) -> Self

Source§

impl Alignable for u64

Source§

fn align_to(&self, alignment: Self) -> Self

Source§

impl Alignable for u128

Source§

fn align_to(&self, alignment: Self) -> Self

Source§

impl Alignable for usize

Source§

fn align_to(&self, alignment: Self) -> Self

Implementors§