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::bytecode::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 Display for ConstantData
impl Display for ConstantData
source§impl Hash for ConstantData
impl Hash for ConstantData
source§impl PartialEq for ConstantData
impl PartialEq for ConstantData
impl Eq for ConstantData
Auto Trait Implementations§
impl Freeze for ConstantData
impl RefUnwindSafe for ConstantData
impl Send for ConstantData
impl Sync for ConstantData
impl Unpin for ConstantData
impl UnwindSafe for ConstantData
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