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

None / null / nil

Boolean value

Signed integer

Unsigned integer

Floating-point value

Utf-8 string

Byte sequence

List / tuple / sequence

Mapping / object

Trait Implementations

impl Debug for Obj
[src]

Formats the value using the given formatter.

impl Clone for Obj
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for Obj
[src]

Returns the "default value" for a type. Read more

impl PartialEq for Obj
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Obj
[src]

impl PartialOrd for Obj
[src]

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

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]

This method returns an Ordering between self and other. Read more

impl Hash for Obj
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl Serialize for Obj
[src]

Serialize this value into the given Serde serializer. Read more

impl<'a> Deserialize<'a> for Obj
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Display for Obj
[src]

Formats the value using the given formatter.