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 From<StorageFormat> for Scalar
impl From<StorageFormat> for Scalar
source§fn from(format: StorageFormat) -> Self
fn from(format: StorageFormat) -> Self
Converts to this type from the input type.
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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.