pub struct Scalar {
pub kind: ScalarKind,
pub width: u8,
}
Expand description
Characteristics of a scalar type.
Fields§
§kind: ScalarKind
How the value’s bits are to be interpreted.
width: u8
This size of the value in bytes.
Implementations§
source§impl Scalar
impl Scalar
sourcepub const fn automatic_conversion_combine(self, other: Scalar) -> Option<Scalar>
pub const fn automatic_conversion_combine(self, other: Scalar) -> 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: Scalar) -> bool
pub fn automatically_converts_to(self, goal: Scalar) -> bool
Return true
if automatic conversions will covert self
to goal
.
source§impl Scalar
impl Scalar
pub const I32: Scalar = _
pub const U32: Scalar = _
pub const F32: Scalar = _
pub const F64: Scalar = _
pub const I64: Scalar = _
pub const BOOL: Scalar = _
pub const ABSTRACT_INT: Scalar = _
pub const ABSTRACT_FLOAT: Scalar = _
pub const fn is_abstract(self) -> bool
sourcepub const fn float(width: u8) -> Scalar
pub const fn float(width: u8) -> Scalar
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 PartialEq for Scalar
impl PartialEq for Scalar
impl Copy for Scalar
impl Eq for Scalar
impl StructuralEq for Scalar
impl StructuralPartialEq for Scalar
Auto Trait Implementations§
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> 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.