pub struct Alignment(/* private fields */);
Expand description
A newtype struct where its only valid values are powers of 2
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<'de> Deserialize<'de> for Alignment
impl<'de> Deserialize<'de> for Alignment
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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 PartialEq for Alignment
impl PartialEq for Alignment
source§impl PartialOrd for Alignment
impl PartialOrd for Alignment
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Alignment
impl Eq for Alignment
impl StructuralEq for Alignment
impl StructuralPartialEq for Alignment
Auto Trait Implementations§
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.