Enum krnl_core::scalar::ScalarElem
source · #[non_exhaustive]pub enum ScalarElem {
U8(u8),
I8(i8),
U16(u16),
I16(i16),
F16(f16),
BF16(bf16),
U32(u32),
I32(i32),
F32(f32),
U64(u64),
I64(i64),
F64(f64),
}
Available on non-
target_arch="spirv"
only.Expand description
Enumeration of all scalars.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
U8(u8)
I8(i8)
U16(u16)
I16(i16)
F16(f16)
BF16(bf16)
U32(u32)
I32(i32)
F32(f32)
U64(u64)
I64(i64)
F64(f64)
Implementations§
source§impl ScalarElem
impl ScalarElem
sourcepub const fn zero(scalar_type: ScalarType) -> Self
pub const fn zero(scalar_type: ScalarType) -> Self
Zero.
sourcepub const fn one(scalar_type: ScalarType) -> Self
pub const fn one(scalar_type: ScalarType) -> Self
One.
sourcepub fn scalar_cast(self, scalar_type: ScalarType) -> Self
pub fn scalar_cast(self, scalar_type: ScalarType) -> Self
Casts to scalar_type
.
See Scalar::cast
.
sourcepub fn cast<T: Scalar>(self) -> T
pub fn cast<T: Scalar>(self) -> T
Casts to T
.
See Scalar::cast
.
sourcepub fn scalar_type(&self) -> ScalarType
pub fn scalar_type(&self) -> ScalarType
The ScalarType
.
sourcepub fn to_scalar_bits(&self) -> Self
pub fn to_scalar_bits(&self) -> Self
The bits of the elem, ie u8, u16, u32, or u64.
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
The bytes as as slice.
See bytemuck::bytes_of
.
Trait Implementations§
source§impl Clone for ScalarElem
impl Clone for ScalarElem
source§fn clone(&self) -> ScalarElem
fn clone(&self) -> ScalarElem
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ScalarElem
impl Debug for ScalarElem
source§impl<'de> Deserialize<'de> for ScalarElem
impl<'de> Deserialize<'de> for ScalarElem
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<T: Scalar> From<T> for ScalarElem
impl<T: Scalar> From<T> for ScalarElem
source§impl PartialEq for ScalarElem
impl PartialEq for ScalarElem
source§fn eq(&self, other: &ScalarElem) -> bool
fn eq(&self, other: &ScalarElem) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ScalarElem
impl Serialize for ScalarElem
source§impl TryFrom<ScalarElem> for bf16
impl TryFrom<ScalarElem> for bf16
source§impl TryFrom<ScalarElem> for f16
impl TryFrom<ScalarElem> for f16
source§impl TryFrom<ScalarElem> for f32
impl TryFrom<ScalarElem> for f32
source§impl TryFrom<ScalarElem> for f64
impl TryFrom<ScalarElem> for f64
source§impl TryFrom<ScalarElem> for i16
impl TryFrom<ScalarElem> for i16
source§impl TryFrom<ScalarElem> for i32
impl TryFrom<ScalarElem> for i32
source§impl TryFrom<ScalarElem> for i64
impl TryFrom<ScalarElem> for i64
source§impl TryFrom<ScalarElem> for i8
impl TryFrom<ScalarElem> for i8
source§impl TryFrom<ScalarElem> for u16
impl TryFrom<ScalarElem> for u16
source§impl TryFrom<ScalarElem> for u32
impl TryFrom<ScalarElem> for u32
source§impl TryFrom<ScalarElem> for u64
impl TryFrom<ScalarElem> for u64
source§impl TryFrom<ScalarElem> for u8
impl TryFrom<ScalarElem> for u8
impl Copy for ScalarElem
impl StructuralPartialEq for ScalarElem
Auto Trait Implementations§
impl Freeze for ScalarElem
impl RefUnwindSafe for ScalarElem
impl Send for ScalarElem
impl Sync for ScalarElem
impl Unpin for ScalarElem
impl UnwindSafe for ScalarElem
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