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

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

Frozen (immutable) set

Implementations

impl HashableValue[src]

pub fn into_value(self) -> Value[src]

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

Trait Implementations

impl Clone for HashableValue[src]

impl Debug for HashableValue[src]

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

impl Display for HashableValue[src]

impl Eq for HashableValue[src]

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.

impl PartialEq<HashableValue> for HashableValue[src]

impl PartialOrd<HashableValue> for HashableValue[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.