Enum cubecl_core::ir::ConstantScalarValue
source · pub enum ConstantScalarValue {
Int(i64, IntKind),
Float(f64, FloatKind),
UInt(u64),
Bool(bool),
}
Expand description
The scalars are stored with the highest precision possible, but they might get reduced during compilation.
Variants§
Implementations§
source§impl ConstantScalarValue
impl ConstantScalarValue
sourcepub fn try_as_usize(&self) -> Option<usize>
pub fn try_as_usize(&self) -> Option<usize>
Returns the value of the scalar as a usize.
It will return None if the scalar type is a float or a bool.
sourcepub fn as_usize(&self) -> usize
pub fn as_usize(&self) -> usize
Returns the value of the scalar as a usize.
It will panics if the scalar type is a float or a bool.
sourcepub fn try_as_u32(&self) -> Option<u32>
pub fn try_as_u32(&self) -> Option<u32>
Returns the value of the scalar as a u32.
It will return None if the scalar type is a float or a bool.
sourcepub fn as_u32(&self) -> u32
pub fn as_u32(&self) -> u32
Returns the value of the scalar as a u32.
It will panics if the scalar type is a float or a bool.
sourcepub fn try_as_u64(&self) -> Option<u64>
pub fn try_as_u64(&self) -> Option<u64>
Returns the value of the scalar as a u64.
It will return None if the scalar type is a float or a bool.
sourcepub fn as_u64(&self) -> u64
pub fn as_u64(&self) -> u64
Returns the value of the scalar as a u64.
It will panics if the scalar type is a float or a bool.
sourcepub fn try_as_i64(&self) -> Option<i64>
pub fn try_as_i64(&self) -> Option<i64>
Returns the value of the scalar as a i64.
It will return None if the scalar type is a float or a bool.
Trait Implementations§
source§impl Clone for ConstantScalarValue
impl Clone for ConstantScalarValue
source§fn clone(&self) -> ConstantScalarValue
fn clone(&self) -> ConstantScalarValue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ConstantScalarValue
impl Debug for ConstantScalarValue
source§impl<'de> Deserialize<'de> for ConstantScalarValue
impl<'de> Deserialize<'de> for ConstantScalarValue
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>,
source§impl PartialEq for ConstantScalarValue
impl PartialEq for ConstantScalarValue
source§impl PartialOrd for ConstantScalarValue
impl PartialOrd for ConstantScalarValue
source§impl Serialize for ConstantScalarValue
impl Serialize for ConstantScalarValue
impl Copy for ConstantScalarValue
impl StructuralPartialEq for ConstantScalarValue
Auto Trait Implementations§
impl Freeze for ConstantScalarValue
impl RefUnwindSafe for ConstantScalarValue
impl Send for ConstantScalarValue
impl Sync for ConstantScalarValue
impl Unpin for ConstantScalarValue
impl UnwindSafe for ConstantScalarValue
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
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)
clone_to_uninit
)