Skip to main content

NestedValue

Enum NestedValue 

Source
pub enum NestedValue {
Show 17 variants Default(Option<String>), Bool(bool), String(String), F32(f32), F64(f64), I16(i16), I32(i32), I64(i64), U8(u8), U16(u16), U64(u64), Map(HashMap<String, NestedValue>), Vec(Vec<NestedValue>), U8s(Vec<u8>), U16s(Vec<u16>), F32s(Vec<f32>), Unsupported(String),
}
Expand description

The main data structure used for deserialization.

It can hold tree-like structures of nested maps and vectors.

Variants§

§

Default(Option<String>)

The default value, which actually does not hold any value and it is used to indicate that the value should be populated with the default value. It contains an optional string with the originator field name.

§

Bool(bool)

A boolean value.

§

String(String)

A string value.

§

F32(f32)

Floating point 32-bit value.

§

F64(f64)

Floating point 64-bit value.

§

I16(i16)

Signed 16-bit integer value.

§

I32(i32)

Signed 32-bit integer value.

§

I64(i64)

Signed 64-bit integer value.

§

U8(u8)

Unsigned 8-bit integer value.

§

U16(u16)

Unsigned 16-bit integer value used for bf16 and f16 serialization

§

U64(u64)

Unsigned 64-bit integer value.

§

Map(HashMap<String, NestedValue>)

A map of nested values (typically used for structs)

§

Vec(Vec<NestedValue>)

A vector of nested values (typically used for vector of structs or numbers)

§

U8s(Vec<u8>)

A vector of 8-bit unsigned integer values.

§

U16s(Vec<u16>)

A vector of 16-bit unsigned integer values.

§

F32s(Vec<f32>)

A vector of 32-bit floating point values.

§

Unsupported(String)

A value that could not be represented, holding the name of its type in the source. Deserializing it into anything is an error; it can only be ignored.

Implementations§

Source§

impl NestedValue

Source

pub fn as_map(self) -> Option<HashMap<String, NestedValue>>

Get the nested value as a map.

Source

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

Get the nested value as a boolean.

Source

pub fn as_string(self) -> Option<String>

Get the nested value as a string.

Source

pub fn as_f32(self) -> Option<f32>

Get the nested value as a f32.

Source

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

Get the nested value as a f64.

Source

pub fn as_i16(self) -> Option<i16>

Get the nested value as an i16.

Source

pub fn as_i32(self) -> Option<i32>

Get the nested value as an i32.

Source

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

Get the nested value as an i64.

Source

pub fn as_u8(self) -> Option<u8>

Get the nested value as a u8.

Source

pub fn as_u16(self) -> Option<u16>

Get the nested value as a u16.

Source

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

Get the nested value as a u64.

Source

pub fn as_bytes(self) -> Option<Vec<u8>>

Get the nested value as a vector of bytes.

Trait Implementations§

Source§

impl Clone for NestedValue

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NestedValue

Source§

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

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.