Struct Scalar
pub struct Scalar {
pub kind: ScalarKind,
pub width: u8,
}Expand description
Characteristics of a scalar type.
Fields§
§kind: ScalarKindHow the value’s bits are to be interpreted.
width: u8This size of the value in bytes.
Implementations§
§impl Scalar
impl Scalar
pub 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.
pub 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.
§impl Scalar
impl Scalar
pub const I32: Scalar
pub const U32: Scalar
pub const F16: Scalar
pub const F32: Scalar
pub const F64: Scalar
pub const I64: Scalar
pub const U64: Scalar
pub const BOOL: Scalar
pub const ABSTRACT_INT: Scalar
pub const ABSTRACT_FLOAT: Scalar
pub const fn is_abstract(self) -> bool
pub 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§
§impl ForDebug for Scalar
impl ForDebug for Scalar
§fn for_debug(self) -> DiagnosticDebug<Self>
fn for_debug(self) -> DiagnosticDebug<Self>
Format this type using
core::fmt::Debug. Read more§impl From<StorageFormat> for Scalar
impl From<StorageFormat> for Scalar
§fn from(format: StorageFormat) -> Scalar
fn from(format: StorageFormat) -> Scalar
Converts to this type from the input type.
§impl Ord for Scalar
impl Ord for Scalar
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
§impl PartialOrd for Scalar
impl PartialOrd for Scalar
§impl TryToWgsl for Scalar
impl TryToWgsl for Scalar
§const DESCRIPTION: &'static str = "scalar type"
const DESCRIPTION: &'static str = "scalar type"
What kind of WGSL thing
Self represents.§fn try_to_wgsl(self) -> Option<&'static str>
fn try_to_wgsl(self) -> Option<&'static str>
§fn to_wgsl_for_diagnostics(self) -> String
fn to_wgsl_for_diagnostics(self) -> String
Return the WGSL form of
self as appropriate for diagnostics. 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 UnsafeUnpin for Scalar
impl UnwindSafe for Scalar
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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
Compare self to
key and return true if they are equal.§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more