pub enum ConstantData {
Tuple {
elements: Vec<ConstantData>,
},
Integer {
value: BigInt,
},
Float {
value: f64,
},
Complex {
value: Complex64,
},
Boolean {
value: bool,
},
Str {
value: String,
},
Bytes {
value: Vec<u8>,
},
Code {
code: Box<CodeObject>,
},
None,
Ellipsis,
}
Expand description
A Constant (which usually encapsulates data within it)
Examples
use rustpython_compiler_core::ConstantData;
let a = ConstantData::Float {value: 120f64};
let b = ConstantData::Boolean {value: false};
assert_ne!(a, b);
Variants§
Tuple
Fields
§
elements: Vec<ConstantData>
Integer
Float
Complex
Boolean
Str
Bytes
Code
Fields
§
code: Box<CodeObject>
None
Ellipsis
Trait Implementations§
source§impl Clone for ConstantData
impl Clone for ConstantData
source§fn clone(&self) -> ConstantData
fn clone(&self) -> ConstantData
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 Constant for ConstantData
impl Constant for ConstantData
type Name = String
source§fn borrow_constant(&self) -> BorrowedConstant<'_, Self>
fn borrow_constant(&self) -> BorrowedConstant<'_, Self>
Transforms the given Constant to a BorrowedConstant
source§impl Debug for ConstantData
impl Debug for ConstantData
source§impl<'de> Deserialize<'de> for ConstantData
impl<'de> Deserialize<'de> for ConstantData
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