pub struct Alignment(/* private fields */);
Available on
wgpu_core
only.Expand description
A newtype struct where its only valid values are powers of 2
Implementations§
source§impl Alignment
impl Alignment
pub const ONE: Alignment = _
pub const TWO: Alignment = _
pub const FOUR: Alignment = _
pub const EIGHT: Alignment = _
pub const SIXTEEN: Alignment = _
pub const MIN_UNIFORM: Alignment = Self::SIXTEEN
pub const fn new(n: u32) -> Option<Alignment>
sourcepub fn from_width(width: u8) -> Alignment
pub fn from_width(width: u8) -> Alignment
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<Alignment, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Alignment, <__D as Deserializer<'de>>::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) -> Alignment
fn from(size: VectorSize) -> Alignment
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 moresource§impl Serialize for Alignment
impl Serialize for Alignment
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl 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.