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
.
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 BOOL: Self
pub const ABSTRACT_INT: Self
pub const ABSTRACT_FLOAT: Self
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<'arbitrary> Arbitrary<'arbitrary> for Scalar
impl<'arbitrary> Arbitrary<'arbitrary> for Scalar
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§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
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> 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.