Enum serde_pickle::value::HashableValue
source · [−]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
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
Implementations
sourceimpl HashableValue
impl HashableValue
sourcepub fn into_value(self) -> Value
pub fn into_value(self) -> Value
Convert the value into its non-hashable version. This always works.
Trait Implementations
sourceimpl Clone for HashableValue
impl Clone for HashableValue
sourcefn clone(&self) -> HashableValue
fn clone(&self) -> HashableValue
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for HashableValue
impl Debug for HashableValue
sourceimpl<'de> Deserialize<'de> for HashableValue
impl<'de> Deserialize<'de> for HashableValue
sourcefn deserialize<D: Deserializer<'de>>(
deser: D
) -> StdResult<HashableValue, D::Error>
fn deserialize<D: Deserializer<'de>>(
deser: D
) -> StdResult<HashableValue, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for HashableValue
impl Display for HashableValue
sourceimpl Ord for HashableValue
impl Ord for HashableValue
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.
sourceimpl PartialEq<HashableValue> for HashableValue
impl PartialEq<HashableValue> for HashableValue
sourceimpl PartialOrd<HashableValue> for HashableValue
impl PartialOrd<HashableValue> for HashableValue
sourcefn partial_cmp(&self, other: &HashableValue) -> Option<Ordering>
fn partial_cmp(&self, other: &HashableValue) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for HashableValue
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more