pub enum PythonPrimitiveValue {
None,
Bool(bool),
Int(String),
Float(f64),
Complex {
real: f64,
imag: f64,
},
String(String),
Bytes(Vec<u8>),
Ellipsis,
}Expand description
Primitive Python-like values for metadata and validation helpers.
Variants§
Implementations§
Source§impl PythonPrimitiveValue
impl PythonPrimitiveValue
Sourcepub fn is_truthy_like(&self) -> bool
pub fn is_truthy_like(&self) -> bool
Returns whether the value is approximately truthy by common Python primitive rules.
Sourcepub const fn is_numeric(&self) -> bool
pub const fn is_numeric(&self) -> bool
Returns whether the value is numeric-like.
Trait Implementations§
Source§impl Clone for PythonPrimitiveValue
impl Clone for PythonPrimitiveValue
Source§fn clone(&self) -> PythonPrimitiveValue
fn clone(&self) -> PythonPrimitiveValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PythonPrimitiveValue
impl Debug for PythonPrimitiveValue
Source§impl PartialEq for PythonPrimitiveValue
impl PartialEq for PythonPrimitiveValue
Source§fn eq(&self, other: &PythonPrimitiveValue) -> bool
fn eq(&self, other: &PythonPrimitiveValue) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PythonPrimitiveValue
Auto Trait Implementations§
impl Freeze for PythonPrimitiveValue
impl RefUnwindSafe for PythonPrimitiveValue
impl Send for PythonPrimitiveValue
impl Sync for PythonPrimitiveValue
impl Unpin for PythonPrimitiveValue
impl UnsafeUnpin for PythonPrimitiveValue
impl UnwindSafe for PythonPrimitiveValue
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