Enum py_marshal::Obj
source · 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
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.