pub enum Value {
None,
Bool(bool),
I64(i64),
Int(BigInt),
F64(f64),
Bytes(Vec<u8>),
String(String),
List(Vec<Value>),
Tuple(Vec<Value>),
Set(BTreeSet<HashableValue>),
FrozenSet(BTreeSet<HashableValue>),
Dict(BTreeMap<HashableValue, Value>),
}Expand description
Represents all primitive builtin Python values that can be restored by unpickling.
Note on integers: the distinction between the two types (short and long) is
very fuzzy in Python, and they can be used interchangeably. In Python 3,
all integers are long integers, so all are pickled as such. While decoding,
we simply put all integers that fit into an i64, and use BigInt for the
rest.
Variants§
None
None
Bool(bool)
Boolean
I64(i64)
Short integer
Int(BigInt)
Long integer (unbounded length)
F64(f64)
Float
Bytes(Vec<u8>)
Bytestring
String(String)
Unicode string
List(Vec<Value>)
List
Tuple(Vec<Value>)
Tuple
Set(BTreeSet<HashableValue>)
Set
FrozenSet(BTreeSet<HashableValue>)
Frozen (immutable) set
Dict(BTreeMap<HashableValue, Value>)
Dictionary (map)
Implementations§
Source§impl Value
impl Value
Sourcepub fn into_hashable(self) -> Result<HashableValue, Error>
pub fn into_hashable(self) -> Result<HashableValue, Error>
Convert the value into a hashable version, if possible. If not, return a ValueNotHashable error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<D: Deserializer<'de>>(deser: D) -> StdResult<Value, D::Error>
fn deserialize<D: Deserializer<'de>>(deser: D) -> StdResult<Value, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more