pub struct Scalar {
pub kind: ScalarKind,
pub width: Bytes,
}
Expand description
Characteristics of a scalar type.
Fields§
§kind: ScalarKind
How the value’s bits are to be interpreted.
width: Bytes
This 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
.
const fn concretize(self) -> Self
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<'de> Deserialize<'de> for Scalar
impl<'de> Deserialize<'de> for Scalar
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 Ord for Scalar
impl Ord for Scalar
source§impl PartialEq for Scalar
impl PartialEq for Scalar
source§impl PartialOrd for Scalar
impl PartialOrd for Scalar
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 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<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.