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

source

pub fn extract_none(self) -> Result<(), Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_stop_iteration(self) -> Result<(), Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_bool(self) -> Result<bool, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_long(self) -> Result<Arc<BigInt>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_float(self) -> Result<f64, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_bytes(self) -> Result<Arc<Vec<u8>>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_string(self) -> Result<Arc<String>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_tuple(self) -> Result<Arc<Vec<Self>>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_list(self) -> Result<ArcRwLock<Vec<Self>>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_dict(self) -> Result<ArcRwLock<HashMap<ObjHashable, Self>>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_set(self) -> Result<ArcRwLock<HashSet<ObjHashable>>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_frozenset(self) -> Result<Arc<HashSet<ObjHashable>>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn extract_code(self) -> Result<Arc<Code>, Self>

Errors

Returns a reference to self if extraction fails

source

pub fn is_none(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_stop_iteration(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_bool(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_long(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_float(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_bytes(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_string(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_tuple(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_list(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_dict(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_set(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_frozenset(&self) -> bool

Errors

Returns a reference to self if extraction fails

source

pub fn is_code(&self) -> bool

Errors

Returns a reference to self if extraction fails

Trait Implementations§

source§

impl Clone for Obj

source§

fn clone(&self) -> Obj

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

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§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&ObjHashable> for Obj

source§

fn from(orig: &ObjHashable) -> Self

Converts to this type from the input type.
source§

impl TryFrom<&Obj> for ObjHashable

§

type Error = Obj

The type returned in the event of a conversion error.
source§

fn try_from(orig: &Obj) -> Result<Self, Obj>

Performs the conversion.

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.