Enum JSONValue

Source
pub enum JSONValue {
Show 14 variants JSONObject { key_value_pairs: Vec<JSONKeyValuePair>, context: Option<JSONObjectContext>, }, JSONArray { values: Vec<JSONArrayValue>, context: Option<JSONArrayContext>, }, Integer(String), Float(String), Exponent(String), Null, Infinity, NaN, Hexadecimal(String), Bool(bool), DoubleQuotedString(String), SingleQuotedString(String), Unary { operator: UnaryOperator, value: Box<JSONValue>, }, Identifier(String),
}
Expand description

Represents a JSON5 value

Where these enum members have Strings, they represent the object as it was tokenized without any modifications (that is, for example, without any escape sequences un-escaped). The single- and double-quoted Strings do not include the surrounding quote characters. The JSONValue::JSONObject

Variants§

§

JSONObject

Represents a JSON5 Object

Fields

§key_value_pairs: Vec<JSONKeyValuePair>

The key-value pairs of the object

§

JSONArray

Represents a JSON5 Array.

§

Integer(String)

Represents an Integer value. The String value is a literal, as it might appear in JSON5 source

§

Float(String)

Represents a float value (not including NaN or Infinity, use JSONValue::NaN or JSONValue::Infinity) The String value is a literal as it might appear in JSON5 source

§

Exponent(String)

Represents an exponent value The String value is a literal as it might appear in JSON5 source

§

Null

§

Infinity

§

NaN

§

Hexadecimal(String)

Represents a hexadecimal value The String value is a literal as it might appear in JSON5 source e.g. String::from("0xDEADBEEF")

§

Bool(bool)

§

DoubleQuotedString(String)

Double-quoted string, as it appears in source. The String value does not include surrounding quotes

§

SingleQuotedString(String)

Single-quoted string, as it appears in source. The String value does not include surrounding quotes

§

Unary

Represents a unary production

Fields

§operator: UnaryOperator
§

Identifier(String)

Represents unquoted identifiers.

Uniquely, a JSONValue::Identifier can only be used in dictionary keys.

Trait Implementations§

Source§

impl Clone for JSONValue

Source§

fn clone(&self) -> JSONValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JSONValue

Source§

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

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

impl Display for JSONValue

Source§

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

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

impl PartialEq for JSONValue

Source§

fn eq(&self, other: &JSONValue) -> 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 JSONValue

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.