pub trait AlignTo {
type TAlign;
// Required methods
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.
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.