Enum serde_utils::Obj
[−]
[src]
pub enum Obj { Null, Bool(bool), Signed(i64), Unsigned(u64), Float(f64), Str(String), Bin(ByteBuf), List(Vec<Obj>), Map(BTreeMap<Obj, Obj>), }
A generic object that can hold any value deserialized via Serde.
The important aspect of this generic object enum is that it can consume all possible values and does not expect any specific types. This makes it possible to deserialize data first and interpret it later.
Warning: Deserializing and even serializing unknown content allows attackers to control the recursion depth of the process and potentially crash it (although in a safe way).
Note: The implementations of PartialEq
, PartialOrd
, and Ord
traits treat NAN
floats as
equal.
The implementations of Hash
, PartialEq
, PartialOrd
, and Ord
traits treat
non-negative Signed
objects like Unsigned
objects with the same value.
Variants
Null
None
/ null
/ nil
Bool(bool)
Boolean value
Signed(i64)
Signed integer
Unsigned(u64)
Unsigned integer
Float(f64)
Floating-point value
Str(String)
Utf-8 string
Bin(ByteBuf)
Byte sequence
List(Vec<Obj>)
List / tuple / sequence
Map(BTreeMap<Obj, Obj>)
Mapping / object
Trait Implementations
impl Debug for Obj
[src]
impl Clone for Obj
[src]
fn clone(&self) -> Obj
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 Default for Obj
[src]
impl PartialEq for Obj
[src]
fn eq(&self, other: &Self) -> 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 Obj
[src]
impl PartialOrd for Obj
[src]
fn partial_cmp(&self, other: &Self) -> 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 Obj
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl Hash for Obj
[src]
fn hash<H>(&self, state: &mut H) where H: Hasher
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl Serialize for Obj
[src]
fn serialize<S: Serializer>(&self, ser: S) -> Result<S::Ok, S::Error>
Serialize this value into the given Serde serializer. Read more
impl<'a> Deserialize<'a> for Obj
[src]
fn deserialize<D: Deserializer<'a>>(de: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more