pub struct Alignment(NonZeroU32);
Expand description
A newtype struct where its only valid values are powers of 2
Tuple Fields§
§0: NonZeroU32
Implementations§
source§impl Alignment
impl Alignment
pub const ONE: Self = _
pub const TWO: Self = _
pub const FOUR: Self = _
pub const EIGHT: Self = _
pub const SIXTEEN: Self = _
pub const MIN_UNIFORM: Self = Self::SIXTEEN
pub const fn new(n: u32) -> Option<Self>
sourcepub fn from_width(width: u8) -> Self
pub fn from_width(width: u8) -> Self
§Panics
If width
is not a power of 2
sourcepub const fn is_aligned(&self, n: u32) -> bool
pub const fn is_aligned(&self, n: u32) -> bool
Returns whether or not n
is a multiple of this alignment.
Trait Implementations§
source§impl From<VectorSize> for Alignment
impl From<VectorSize> for Alignment
source§fn from(size: VectorSize) -> Self
fn from(size: VectorSize) -> Self
Converts to this type from the input type.
source§impl Ord for Alignment
impl Ord for Alignment
source§impl PartialOrd for Alignment
impl PartialOrd for Alignment
impl Copy for Alignment
impl Eq for Alignment
impl StructuralPartialEq for Alignment
Auto Trait Implementations§
impl Freeze for Alignment
impl RefUnwindSafe for Alignment
impl Send for Alignment
impl Sync for Alignment
impl Unpin for Alignment
impl UnwindSafe for Alignment
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.