[go: up one dir, main page]

Struct sonic_rs::Document

source ·
pub struct Document { /* private fields */ }

Implementations§

source§

impl Document

source

pub fn new() -> Document

source

pub fn as_value(&self) -> &Value<'_>

source

pub fn as_value_mut(&mut self) -> ValueMut<'_>

source

pub fn as_array_mut(&mut self) -> Option<ArrayMut<'_>>

source

pub fn as_object_mut(&mut self) -> Option<ObjectMut<'_>>

Trait Implementations§

source§

impl Default for Document

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl JsonValue for Document

§

type ValueType<'dom> = &'dom Value<'dom> where Self: 'dom

source§

fn get_type(&self) -> JsonType

get the type of the JsonValue.
source§

fn as_bool(&self) -> Option<bool>

Returns the bool if the JsonValue is a boolean.
source§

fn as_number(&self) -> Option<Number>

Returns the Number value of the JsonValue if it is a Number.
source§

fn as_str(&self) -> Option<&str>

Returns the str if the JsonValue is a string.
source§

fn get<I: Index>(&self, index: I) -> Option<Self::ValueType<'_>>

Returns the value from index if the JsonValue is an array or object The index may be usize or &str. The usize is for array, the &str is for object.
source§

fn pointer(&self, path: &JsonPointer<'_>) -> Option<Self::ValueType<'_>>

Returns the value from pointer path if the JsonValue is an array or object
source§

fn is_boolean(&self) -> bool

Returns true if the JsonValue is a bool.
source§

fn is_true(&self) -> bool

Returns true if the JsonValue is true.
source§

fn is_false(&self) -> bool

Returns true if the JsonValue is false.
source§

fn is_null(&self) -> bool

Returns true if the JsonValue is null.
source§

fn is_number(&self) -> bool

Returns true if the JsonValue is a number.
source§

fn is_str(&self) -> bool

Returns true if the JsonValue is a string.
source§

fn is_array(&self) -> bool

Returns true if the JsonValue is an array.
source§

fn is_object(&self) -> bool

Returns true if the JsonValue is an object.
source§

fn is_f64(&self) -> bool

Returns true if the JsonValue is a f64.
source§

fn is_i64(&self) -> bool

Returns true if the JsonValue is an i64.
source§

fn is_u64(&self) -> bool

Returns true if the JsonValue is a u64.
source§

fn as_i64(&self) -> Option<i64>

Returns the i64 value of the JsonValue if it is a i64.
source§

fn as_u64(&self) -> Option<u64>

Returns the u64 value of the JsonValue if it is a u64.
source§

fn as_f64(&self) -> Option<f64>

Returns the f64 value of the JsonValue if it is a f64.
source§

impl Serialize for Document

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

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, U> Cast<U> for T
where U: FromCast<T>,

source§

fn cast(self) -> U

Numeric cast from self to T.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromCast<T> for T

source§

fn from_cast(t: T) -> T

Numeric cast from T to Self.
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>,

§

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.