pub enum Constant {
Undef {
dtype: Dtype,
},
Unit,
Int {
value: u128,
width: usize,
is_signed: bool,
},
Float {
value: OrderedFloat<f64>,
width: usize,
},
GlobalVariable {
name: String,
dtype: Dtype,
},
}
Variants§
Undef
Unit
Int
Float
Fields
§
value: OrderedFloat<f64>
value
may be f32
, but it is possible to consider it as f64
.
- Casting from an f32 to an f64 is perfect and lossless (f32 -> f64)
- Casting from an f64 to an f32 will produce the closest possible value (f64 -> f32)
For more details: https://doc.rust-lang.org/stable/reference/expressions/operator-expr.html#type-cast-expressions
GlobalVariable
Implementations§
Source§impl Constant
impl Constant
const DECIMAL: u32 = 10u32
const OCTAL: u32 = 8u32
const HEXADECIMAL: u32 = 16u32
const BINARY: u32 = 2u32
pub fn is_integer_constant(&self) -> bool
pub fn undef(dtype: Dtype) -> Self
pub fn unit() -> Self
pub fn int(value: u128, dtype: Dtype) -> Self
pub fn float(value: f64, dtype: Dtype) -> Self
pub fn global_variable(name: String, dtype: Dtype) -> Self
pub fn get_int(&self) -> Option<(u128, usize, bool)>
pub fn get_global_variable_name(&self) -> Option<String>
fn minus(self) -> Self
pub fn is_undef(&self) -> bool
pub fn typecast(self, target_dtype: Dtype) -> Self
Trait Implementations§
Source§impl TryFrom<&Expression> for Constant
impl TryFrom<&Expression> for Constant
impl Eq for Constant
impl StructuralPartialEq for Constant
Auto Trait Implementations§
impl Freeze for Constant
impl RefUnwindSafe for Constant
impl Send for Constant
impl Sync for Constant
impl Unpin for Constant
impl UnwindSafe for Constant
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<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