pub trait AlignTo {
type TAlign;
fn align_to(self, align: Self::TAlign) -> Self;
fn aligned_to(self, align: Self::TAlign) -> bool;
}
Expand description
Helper to implement generic alignment operator.
Required Associated Types
Required Methods
sourcefn align_to(self, align: Self::TAlign) -> Self
fn align_to(self, align: Self::TAlign) -> Self
Aligns the given value to a multiple of the align value.
Debug asserts that align is a power of two, otherwise calculates an incorrect result.
sourcefn aligned_to(self, align: Self::TAlign) -> bool
fn aligned_to(self, align: Self::TAlign) -> bool
Checks if the given value is aligned to a multiple of the align value.
Debug asserts that align is a power of two, otherwise calculates an incorrect result.