JsonExpr

Enum JsonExpr 

Source
pub enum JsonExpr {
    Obj {
        values: BTreeMap<String, JsonExpr>,
    },
    Arr(Vec<JsonExpr>),
    Str(String),
    Num(f64),
    Bool(bool),
    Null(()),
}
Expand description

An ESExpr representation of a JSON value.

Variants§

§

Obj

A JSON Object

Fields

§values: BTreeMap<String, JsonExpr>

The fields of the object.

§

Arr(Vec<JsonExpr>)

A JSON Array

§

Str(String)

A JSON String

§

Num(f64)

A JSON Number

§

Bool(bool)

A JSON Boolean

§

Null(())

A JSON Null value

Implementations§

Source§

impl JsonExpr

Source

pub fn from_json(value: Value) -> Option<JsonExpr>

Converts a serde_json::Value into a JsonExpr

Source

pub fn into_json(self) -> Option<Value>

Converts a JsonExpr into a serde_json::Value

Trait Implementations§

Source§

impl Debug for JsonExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'esexpr_lifetime> ESExprCodec<'esexpr_lifetime> for JsonExpr

Source§

const TAGS: ESExprTagSet

The tags of the encoded expressions that this type can produce.
Source§

fn encode_esexpr(&'esexpr_lifetime self) -> ESExpr<'esexpr_lifetime>

Encode this value into an expression.
Source§

fn decode_esexpr(expr: ESExpr<'esexpr_lifetime>) -> Result<Self, DecodeError>

Decode an expression into a value. Read more
Source§

impl ESExprEncodedEq for JsonExpr

Source§

fn is_encoded_eq(&self, other: &Self) -> bool

Determines whether two values are equal when encoded as ESExpr.
Source§

impl PartialEq for JsonExpr

Source§

fn eq(&self, other: &JsonExpr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for JsonExpr

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.