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

None

Bool(bool)

Boolean

I64(i64)

Short integer

Int(BigInt)

Long integer

F64(f64)

Float

Bytes(Vec<u8>)

Bytestring

String(String)

Unicode string

Tuple(Vec<HashableValue>)

Tuple

FrozenSet(BTreeSet<HashableValue>)

Frozen (immutable) set

Methods

impl HashableValue
[src]

fn into_value(self) -> Value

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

Trait Implementations

impl Debug for HashableValue
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for HashableValue
[src]

fn clone(&self) -> HashableValue

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Display for HashableValue
[src]

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

Formats the value using the given formatter.

impl PartialEq for HashableValue
[src]

fn eq(&self, other: &HashableValue) -> bool

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

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl Eq for HashableValue
[src]

impl PartialOrd for HashableValue
[src]

fn partial_cmp(&self, other: &HashableValue) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool
1.0.0

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

fn le(&self, other: &Rhs) -> bool
1.0.0

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

fn gt(&self, other: &Rhs) -> bool
1.0.0

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

fn ge(&self, other: &Rhs) -> bool
1.0.0

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.

fn cmp(&self, other: &HashableValue) -> Ordering

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

impl Deserialize for HashableValue
[src]

fn deserialize<D>(deser: &mut D) -> StdResult<HashableValue, D::Error> where D: Deserializer

Deserialize this value given this Deserializer.