pub enum Obj {
Show 15 variants
None,
StopIteration,
Ellipsis,
Bool(bool),
Long(Arc<BigInt>),
Float(f64),
Complex(Complex<f64>),
Bytes(Arc<Vec<u8>>),
String(Arc<String>),
Tuple(Arc<Vec<Obj>>),
List(ArcRwLock<Vec<Obj>>),
Dict(ArcRwLock<HashMap<ObjHashable, Obj>>),
Set(ArcRwLock<HashSet<ObjHashable>>),
FrozenSet(Arc<HashSet<ObjHashable>>),
Code(Arc<Code>),
}
Variants§
None
StopIteration
Ellipsis
Bool(bool)
Long(Arc<BigInt>)
Float(f64)
Complex(Complex<f64>)
Bytes(Arc<Vec<u8>>)
String(Arc<String>)
Tuple(Arc<Vec<Obj>>)
List(ArcRwLock<Vec<Obj>>)
Dict(ArcRwLock<HashMap<ObjHashable, Obj>>)
Set(ArcRwLock<HashSet<ObjHashable>>)
FrozenSet(Arc<HashSet<ObjHashable>>)
Code(Arc<Code>)
Implementations§
Source§impl Obj
impl Obj
Sourcepub fn extract_none(self) -> Result<(), Self>
pub fn extract_none(self) -> Result<(), Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_stop_iteration(self) -> Result<(), Self>
pub fn extract_stop_iteration(self) -> Result<(), Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_bool(self) -> Result<bool, Self>
pub fn extract_bool(self) -> Result<bool, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_long(self) -> Result<Arc<BigInt>, Self>
pub fn extract_long(self) -> Result<Arc<BigInt>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_float(self) -> Result<f64, Self>
pub fn extract_float(self) -> Result<f64, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_bytes(self) -> Result<Arc<Vec<u8>>, Self>
pub fn extract_bytes(self) -> Result<Arc<Vec<u8>>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_string(self) -> Result<Arc<String>, Self>
pub fn extract_string(self) -> Result<Arc<String>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_tuple(self) -> Result<Arc<Vec<Self>>, Self>
pub fn extract_tuple(self) -> Result<Arc<Vec<Self>>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_list(self) -> Result<ArcRwLock<Vec<Self>>, Self>
pub fn extract_list(self) -> Result<ArcRwLock<Vec<Self>>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_dict(self) -> Result<ArcRwLock<HashMap<ObjHashable, Self>>, Self>
pub fn extract_dict(self) -> Result<ArcRwLock<HashMap<ObjHashable, Self>>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_set(self) -> Result<ArcRwLock<HashSet<ObjHashable>>, Self>
pub fn extract_set(self) -> Result<ArcRwLock<HashSet<ObjHashable>>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_frozenset(self) -> Result<Arc<HashSet<ObjHashable>>, Self>
pub fn extract_frozenset(self) -> Result<Arc<HashSet<ObjHashable>>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn extract_code(self) -> Result<Arc<Code>, Self>
pub fn extract_code(self) -> Result<Arc<Code>, Self>
§Errors
Returns a reference to self if extraction fails
Sourcepub fn is_stop_iteration(&self) -> bool
pub fn is_stop_iteration(&self) -> bool
§Errors
Returns a reference to self if extraction fails
Sourcepub fn is_frozenset(&self) -> bool
pub fn is_frozenset(&self) -> bool
§Errors
Returns a reference to self if extraction fails
Trait Implementations§
Source§impl Debug for Obj
Should mostly match Python’s repr
impl Debug for Obj
Should mostly match Python’s repr
§Float, Complex
- Uses
float('...')
instead of...
for nan, inf, and -inf. - Uses Rust’s float-to-decimal conversion.
§Bytes, String
- Always uses double-quotes
- Escapes both kinds of quotes
§Code
- Uses named arguments for readability
- lnotab is formatted as bytes(…) with a list of integers, instead of a bytes literal
Source§impl From<&ObjHashable> for Obj
impl From<&ObjHashable> for Obj
Source§fn from(orig: &ObjHashable) -> Self
fn from(orig: &ObjHashable) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Obj
impl RefUnwindSafe for Obj
impl Send for Obj
impl Sync for Obj
impl Unpin for Obj
impl UnwindSafe for Obj
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