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
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
Bytestring
String(String)
Unicode string
Tuple Fields of String
0: String
Tuple(Vec<HashableValue>)
Tuple
Tuple Fields of Tuple
0: Vec<HashableValue>
FrozenSet(BTreeSet<HashableValue>)
Frozen (immutable) set
Tuple Fields of FrozenSet
Implementations
Convert the value into its non-hashable version. This always works.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
Implement a (more or less) consistent ordering for HashableValue
s
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
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
Auto Trait Implementations
impl RefUnwindSafe for HashableValue
impl Send for HashableValue
impl Sync for HashableValue
impl Unpin for HashableValue
impl UnwindSafe for HashableValue
Blanket Implementations
Mutably borrows from an owned value. Read more