pub struct Scalar {
pub kind: ScalarKind,
pub width: Bytes,
}Expand description
Characteristics of a scalar type.
Fields§
§kind: ScalarKindHow the value’s bits are to be interpreted.
width: BytesThis size of the value in bytes.
Implementations§
Source§impl Scalar
impl Scalar
Sourcepub const fn automatic_conversion_combine(self, other: Self) -> Option<Scalar>
pub const fn automatic_conversion_combine(self, other: Self) -> Option<Scalar>
Find the common type of self and other under WGSL’s
automatic conversions.
If there are any scalars to which WGSL’s automatic conversions
will convert both self and other, return the best such
scalar. Otherwise, return None.
Sourcepub fn automatically_converts_to(self, goal: Self) -> bool
pub fn automatically_converts_to(self, goal: Self) -> bool
Return true if automatic conversions will covert self to goal.
Source§impl Scalar
impl Scalar
pub const I32: Self
pub const U32: Self
pub const F32: Self
pub const F64: Self
pub const I64: Self
pub const U64: Self
pub const BOOL: Self
pub const ABSTRACT_INT: Self
pub const ABSTRACT_FLOAT: Self
pub const fn is_abstract(self) -> bool
Sourcepub const fn float(width: Bytes) -> Self
pub const fn float(width: Bytes) -> Self
Construct a float Scalar with the given width.
This is especially common when dealing with
TypeInner::Matrix, where the scalar kind is implicit.
pub const fn to_inner_scalar(self) -> TypeInner
pub const fn to_inner_vector(self, size: VectorSize) -> TypeInner
pub const fn to_inner_atomic(self) -> TypeInner
Trait Implementations§
Source§impl Ord for Scalar
impl Ord for Scalar
Source§impl PartialOrd for Scalar
impl PartialOrd for Scalar
impl Copy for Scalar
impl Eq for Scalar
impl StructuralPartialEq for Scalar
Auto Trait Implementations§
impl Freeze for Scalar
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
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§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
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.