Enum serde_pickle::value::HashableValue[][src]

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

Represents all primitive builtin Python values that can be contained in a “hashable” context (i.e., as dictionary keys and set elements).

In Rust, the type is not hashable, since we use B-tree maps and sets instead of the hash variants. To be able to put all Value instances into these B-trees, we implement a consistent ordering between all the possible types (see below).

Variants

None

None

Bool(bool)

Boolean

Tuple Fields of Bool

0: bool
I64(i64)

Short integer

Tuple Fields of I64

0: i64
Int(BigInt)

Long integer

Tuple Fields of Int

0: BigInt
F64(f64)

Float

Tuple Fields of F64

0: f64
Bytes(Vec<u8>)

Bytestring

Tuple Fields of Bytes

0: Vec<u8>
String(String)

Unicode string

Tuple Fields of String

0: String

Tuple

Tuple Fields of Tuple

0: Vec<HashableValue>

Frozen (immutable) set

Tuple Fields of FrozenSet

0: BTreeSet<HashableValue>

Implementations

Convert the value into its non-hashable version. This always works.

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

Implement a (more or less) consistent ordering for HashableValues so that they can be added to dictionaries and sets.

Also, like in Python, numeric values with the same value (integral or not) must compare equal.

For other types, we define an ordering between all types A and B so that all objects of type A are always lesser than objects of type B. This is done similar to Python 2’s ordering of different types.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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

Performs the conversion.

Performs the conversion.

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)

recently added

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.