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>),
}

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

Boolean

Short integer

Long integer

Float

Bytestring

Unicode string

Tuple

Frozen (immutable) set

Methods

impl HashableValue
[src]

[src]

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

Trait Implementations

impl Clone for HashableValue
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for HashableValue
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for HashableValue
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for HashableValue
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Eq for HashableValue
[src]

impl PartialOrd for HashableValue
[src]

[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

impl Ord for HashableValue
[src]

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.

[src]

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

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<'de> Deserialize<'de> for HashableValue
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

impl Send for HashableValue

impl Sync for HashableValue