pub enum Value {
    None,
    Bool(bool),
    I64(i64),
    Int(BigInt),
    F64(f64),
    Bytes(Vec<u8>),
    String(String),
    List(Vec<Value>),
    Tuple(Vec<Value>),
    Set(BTreeSet<HashableValue>),
    FrozenSet(BTreeSet<HashableValue>),
    Dict(BTreeMap<HashableValue, Value>),
}
Expand description

Represents all primitive builtin Python values that can be restored by unpickling.

Note on integers: the distinction between the two types (short and long) is very fuzzy in Python, and they can be used interchangeably. In Python 3, all integers are long integers, so all are pickled as such. While decoding, we simply put all integers that fit into an i64, and use BigInt for the rest.

Variants

None

None

Bool(bool)

Boolean

I64(i64)

Short integer

Int(BigInt)

Long integer (unbounded length)

F64(f64)

Float

Bytes(Vec<u8>)

Bytestring

String(String)

Unicode string

List(Vec<Value>)

List

Tuple(Vec<Value>)

Tuple

Set(BTreeSet<HashableValue>)

Set

FrozenSet(BTreeSet<HashableValue>)

Frozen (immutable) set

Dict(BTreeMap<HashableValue, Value>)

Dictionary (map)

Implementations

Convert the value into a hashable version, if possible. If not, return a ValueNotHashable error.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.