Enum rustpython_vm::compiler::core::bytecode::ConstantData
source · pub enum ConstantData {
Tuple {
elements: Vec<ConstantData, Global>,
},
Integer {
value: BigInt,
},
Float {
value: f64,
},
Complex {
value: Complex<f64>,
},
Boolean {
value: bool,
},
Str {
value: String,
},
Bytes {
value: Vec<u8, Global>,
},
Code {
code: Box<CodeObject<ConstantData>, Global>,
},
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, Global>
Integer
Float
Complex
Boolean
Str
Bytes
Code
Fields
§
code: Box<CodeObject<ConstantData>, Global>
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<'_, ConstantData>
fn borrow_constant(&self) -> BorrowedConstant<'_, ConstantData>
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<ConstantData> for ConstantData
impl PartialEq<ConstantData> for ConstantData
source§fn eq(&self, other: &ConstantData) -> bool
fn eq(&self, other: &ConstantData) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for ConstantData
Auto Trait Implementations§
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
source§impl<T> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere T: Hash + ?Sized,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.