Enum jiter::JsonValue

source ·
pub enum JsonValue<'s> {
    Null,
    Bool(bool),
    Int(i64),
    BigInt(BigInt),
    Float(f64),
    Str(Cow<'s, str>),
    Array(JsonArray<'s>),
    Object(JsonObject<'s>),
}
Expand description

Enum representing a JSON value.

Variants§

§

Null

§

Bool(bool)

§

Int(i64)

§

BigInt(BigInt)

§

Float(f64)

§

Str(Cow<'s, str>)

§

Array(JsonArray<'s>)

§

Object(JsonObject<'s>)

Implementations§

source§

impl<'j> JsonValue<'j>

source

pub fn parse(data: &'j [u8], allow_inf_nan: bool) -> Result<Self, JsonError>

Parse a JSON enum from a byte slice, returning a borrowed version of the enum - e.g. strings can be references into the original byte slice.

source

pub fn into_static(self) -> JsonValue<'static>

Convert a borrowed JSON enum into an owned JSON enum.

source

pub fn to_static(&self) -> JsonValue<'static>

Copy a borrowed JSON enum into an owned JSON enum.

source§

impl JsonValue<'static>

source

pub fn parse_owned(data: &[u8], allow_inf_nan: bool) -> Result<Self, JsonError>

Parse a JSON enum from a byte slice, returning an owned version of the enum.

Trait Implementations§

source§

impl<'s> Clone for JsonValue<'s>

source§

fn clone(&self) -> JsonValue<'s>

Returns a copy 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<'s> Debug for JsonValue<'s>

source§

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

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

impl<'s> PartialEq for JsonValue<'s>

source§

fn eq(&self, other: &JsonValue<'s>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToPyObject for JsonValue<'_>

source§

fn to_object(&self, py: Python<'_>) -> PyObject

Converts self into a Python object.
source§

impl<'s> StructuralPartialEq for JsonValue<'s>

Auto Trait Implementations§

§

impl<'s> Freeze for JsonValue<'s>

§

impl<'s> RefUnwindSafe for JsonValue<'s>

§

impl<'s> Send for JsonValue<'s>

§

impl<'s> Sync for JsonValue<'s>

§

impl<'s> Unpin for JsonValue<'s>

§

impl<'s> UnwindSafe for JsonValue<'s>

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> Ungil for T
where T: Send,