pub enum PythonValue {
None,
Boolean(bool),
Integer(i64),
Float(f64),
String(String),
List(Vec<Arc<PythonValue>>),
Tuple(Vec<Arc<PythonValue>>),
Dict(HashMap<String, Arc<PythonValue>>),
Object(String, HashMap<String, Arc<PythonValue>>),
Function(String),
}Expand description
Python value type
Variants§
None
None value
Boolean(bool)
Boolean value
Integer(i64)
Integer value
Float(f64)
Float value
String(String)
String value
List(Vec<Arc<PythonValue>>)
List value
Tuple(Vec<Arc<PythonValue>>)
Tuple value
Dict(HashMap<String, Arc<PythonValue>>)
Dict value
Object(String, HashMap<String, Arc<PythonValue>>)
Object value
Function(String)
Function value
Implementations§
Source§impl PythonValue
impl PythonValue
Sourcepub fn get_item(&self, index: &PythonValue) -> PythonResult<Arc<PythonValue>>
pub fn get_item(&self, index: &PythonValue) -> PythonResult<Arc<PythonValue>>
Get item from collection
Sourcepub fn set_item(
&mut self,
index: &PythonValue,
value: Arc<PythonValue>,
) -> PythonResult<()>
pub fn set_item( &mut self, index: &PythonValue, value: Arc<PythonValue>, ) -> PythonResult<()>
Set item in collection
Sourcepub fn append(&mut self, value: Arc<PythonValue>) -> PythonResult<()>
pub fn append(&mut self, value: Arc<PythonValue>) -> PythonResult<()>
Append item to list
Sourcepub fn add(&self, other: &PythonValue) -> PythonResult<PythonValue>
pub fn add(&self, other: &PythonValue) -> PythonResult<PythonValue>
Add two values
Sourcepub fn sub(&self, other: &PythonValue) -> PythonResult<PythonValue>
pub fn sub(&self, other: &PythonValue) -> PythonResult<PythonValue>
Subtract two values
Sourcepub fn mul(&self, other: &PythonValue) -> PythonResult<PythonValue>
pub fn mul(&self, other: &PythonValue) -> PythonResult<PythonValue>
Multiply two values
Sourcepub fn div(&self, other: &PythonValue) -> PythonResult<PythonValue>
pub fn div(&self, other: &PythonValue) -> PythonResult<PythonValue>
Divide two values
Sourcepub fn eq(&self, other: &PythonValue) -> bool
pub fn eq(&self, other: &PythonValue) -> bool
Check equality
Sourcepub fn lt(&self, other: &PythonValue) -> PythonResult<bool>
pub fn lt(&self, other: &PythonValue) -> PythonResult<bool>
Check less than
Sourcepub fn gt(&self, other: &PythonValue) -> PythonResult<bool>
pub fn gt(&self, other: &PythonValue) -> PythonResult<bool>
Check greater than
Trait Implementations§
Source§impl Clone for PythonValue
impl Clone for PythonValue
Source§fn clone(&self) -> PythonValue
fn clone(&self) -> PythonValue
Returns a duplicate 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 Debug for PythonValue
impl Debug for PythonValue
Source§impl PartialEq for PythonValue
impl PartialEq for PythonValue
impl StructuralPartialEq for PythonValue
Auto Trait Implementations§
impl Freeze for PythonValue
impl RefUnwindSafe for PythonValue
impl Send for PythonValue
impl Sync for PythonValue
impl Unpin for PythonValue
impl UnsafeUnpin for PythonValue
impl UnwindSafe for PythonValue
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