Enum Variant

Source
pub enum Variant {
Show 16 variants None, Bool(bool), Int8(i8), UInt8(u8), Int16(i16), UInt16(u16), Int32(i32), UInt32(u32), Int64(i64), UInt64(u64), Float(f32), Double(f64), String(String), Buffer(Vec<u8>), Array(Vec<Variant>), Dict(HashMap<String, Variant>),
}

Variants§

§

None

§

Bool(bool)

§

Int8(i8)

§

UInt8(u8)

§

Int16(i16)

§

UInt16(u16)

§

Int32(i32)

§

UInt32(u32)

§

Int64(i64)

§

UInt64(u64)

§

Float(f32)

§

Double(f64)

§

String(String)

§

Buffer(Vec<u8>)

§

Array(Vec<Variant>)

§

Dict(HashMap<String, Variant>)

Implementations§

Source§

impl Variant

Source

pub fn new() -> Self

Source

pub fn new_array() -> Self

Source

pub fn new_dict() -> Variant

Source

pub fn len(&self) -> usize

Source

pub fn clear(&mut self)

Source

pub fn concat(&mut self, other: &Self) -> bool

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_number(&self) -> bool

Source

pub fn set<T: Into<Self>>(&mut self, value: T)

Source

pub fn get<T: From<Self>>(&self) -> T

Source

pub fn get_number<T>(&self) -> Option<T>
where T: FromPrimitive,

Source

pub fn array_add(&mut self, value: Variant)

Source

pub fn array_get(&self, index: usize) -> Option<Variant>

Source

pub fn array_set(&mut self, index: usize, value: Variant)

Source

pub fn array_remove(&mut self, index: usize) -> bool

Source

pub fn dict_get(&self, key: &str) -> Option<Variant>

Source

pub fn dict_set(&mut self, key: &str, value: Variant)

Source

pub fn dict_remove(&mut self, key: &str) -> bool

Source

pub fn dict_contains(&self, key: &str) -> bool

Source

pub fn array_iter(&self) -> Option<impl Iterator<Item = &Variant> + '_>

Source

pub fn array_iter_mut( &mut self, ) -> Option<impl Iterator<Item = &mut Variant> + '_>

Source

pub fn dict_iter( &self, ) -> Option<impl Iterator<Item = (&String, &Variant)> + '_>

Source

pub fn dict_iter_mut( &mut self, ) -> Option<impl Iterator<Item = (&String, &mut Variant)> + '_>

Source

pub fn get_bool(&self) -> Option<bool>

Source

pub fn get_string(&self) -> Option<String>

Source

pub fn get_buffer(&self) -> Option<Vec<u8>>

Source

pub fn get_int8(&self) -> Option<i8>

Source

pub fn get_uint8(&self) -> Option<u8>

Source

pub fn get_int16(&self) -> Option<i16>

Source

pub fn get_uint16(&self) -> Option<u16>

Source

pub fn get_int32(&self) -> Option<i32>

Source

pub fn get_uint32(&self) -> Option<u32>

Source

pub fn get_int64(&self) -> Option<i64>

Source

pub fn get_uint64(&self) -> Option<u64>

Source

pub fn get_float(&self) -> Option<f32>

Source

pub fn get_double(&self) -> Option<f64>

Source

pub fn set_bool(&mut self, value: bool)

Source

pub fn array_add_bool(&mut self, value: bool)

Source

pub fn array_get_bool(&self, index: usize) -> Option<bool>

Source

pub fn array_set_bool(&mut self, index: usize, value: bool)

Source

pub fn dict_get_bool(&self, key: &str) -> Option<bool>

Source

pub fn dict_set_bool(&mut self, key: &str, value: bool)

Source

pub fn set_int8(&mut self, value: i8)

Source

pub fn array_add_int8(&mut self, value: i8)

Source

pub fn array_get_int8(&self, index: usize) -> Option<i8>

Source

pub fn array_set_int8(&mut self, index: usize, value: i8)

Source

pub fn dict_get_int8(&self, key: &str) -> Option<i8>

Source

pub fn dict_set_int8(&mut self, key: &str, value: i8)

Source

pub fn set_uint8(&mut self, value: u8)

Source

pub fn array_add_uint8(&mut self, value: u8)

Source

pub fn array_get_uint8(&self, index: usize) -> Option<u8>

Source

pub fn array_set_uint8(&mut self, index: usize, value: u8)

Source

pub fn dict_get_uint8(&self, key: &str) -> Option<u8>

Source

pub fn dict_set_uint8(&mut self, key: &str, value: u8)

Source

pub fn set_int16(&mut self, value: i16)

Source

pub fn array_add_int16(&mut self, value: i16)

Source

pub fn array_get_int16(&self, index: usize) -> Option<i16>

Source

pub fn array_set_int16(&mut self, index: usize, value: i16)

Source

pub fn dict_get_int16(&self, key: &str) -> Option<i16>

Source

pub fn dict_set_int16(&mut self, key: &str, value: i16)

Source

pub fn set_uint16(&mut self, value: u16)

Source

pub fn array_add_uint16(&mut self, value: u16)

Source

pub fn array_get_uint16(&self, index: usize) -> Option<u16>

Source

pub fn array_set_uint16(&mut self, index: usize, value: u16)

Source

pub fn dict_get_uint16(&self, key: &str) -> Option<u16>

Source

pub fn dict_set_uint16(&mut self, key: &str, value: u16)

Source

pub fn set_int32(&mut self, value: i32)

Source

pub fn array_add_int32(&mut self, value: i32)

Source

pub fn array_get_int32(&self, index: usize) -> Option<i32>

Source

pub fn array_set_int32(&mut self, index: usize, value: i32)

Source

pub fn dict_get_int32(&self, key: &str) -> Option<i32>

Source

pub fn dict_set_int32(&mut self, key: &str, value: i32)

Source

pub fn set_uint32(&mut self, value: u32)

Source

pub fn array_add_uint32(&mut self, value: u32)

Source

pub fn array_get_uint32(&self, index: usize) -> Option<u32>

Source

pub fn array_set_uint32(&mut self, index: usize, value: u32)

Source

pub fn dict_get_uint32(&self, key: &str) -> Option<u32>

Source

pub fn dict_set_uint32(&mut self, key: &str, value: u32)

Source

pub fn set_int64(&mut self, value: i64)

Source

pub fn array_add_int64(&mut self, value: i64)

Source

pub fn array_get_int64(&self, index: usize) -> Option<i64>

Source

pub fn array_set_int64(&mut self, index: usize, value: i64)

Source

pub fn dict_get_int64(&self, key: &str) -> Option<i64>

Source

pub fn dict_set_int64(&mut self, key: &str, value: i64)

Source

pub fn set_uint64(&mut self, value: u64)

Source

pub fn array_add_uint64(&mut self, value: u64)

Source

pub fn array_get_uint64(&self, index: usize) -> Option<u64>

Source

pub fn array_set_uint64(&mut self, index: usize, value: u64)

Source

pub fn dict_get_uint64(&self, key: &str) -> Option<u64>

Source

pub fn dict_set_uint64(&mut self, key: &str, value: u64)

Source

pub fn set_float(&mut self, value: f32)

Source

pub fn array_add_float(&mut self, value: f32)

Source

pub fn array_get_float(&self, index: usize) -> Option<f32>

Source

pub fn array_set_float(&mut self, index: usize, value: f32)

Source

pub fn dict_get_float(&self, key: &str) -> Option<f32>

Source

pub fn dict_set_float(&mut self, key: &str, value: f32)

Source

pub fn set_double(&mut self, value: f64)

Source

pub fn array_add_double(&mut self, value: f64)

Source

pub fn array_get_double(&self, index: usize) -> Option<f64>

Source

pub fn array_set_double(&mut self, index: usize, value: f64)

Source

pub fn dict_get_double(&self, key: &str) -> Option<f64>

Source

pub fn dict_set_double(&mut self, key: &str, value: f64)

Source

pub fn set_string(&mut self, value: String)

Source

pub fn array_add_string(&mut self, value: String)

Source

pub fn array_get_string(&self, index: usize) -> Option<String>

Source

pub fn array_set_string(&mut self, index: usize, value: String)

Source

pub fn dict_get_string(&self, key: &str) -> Option<String>

Source

pub fn dict_set_string(&mut self, key: &str, value: String)

Source

pub fn set_buffer(&mut self, value: Vec<u8>)

Source

pub fn array_add_buffer(&mut self, value: Vec<u8>)

Source

pub fn array_get_buffer(&self, index: usize) -> Option<Vec<u8>>

Source

pub fn array_set_buffer(&mut self, index: usize, value: Vec<u8>)

Source

pub fn dict_get_buffer(&self, key: &str) -> Option<Vec<u8>>

Source

pub fn dict_set_buffer(&mut self, key: &str, value: Vec<u8>)

Trait Implementations§

Source§

impl Clone for Variant

Source§

fn clone(&self) -> Variant

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 Variant

Source§

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

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

impl<'de> Deserialize<'de> for Variant

Source§

fn deserialize<D>(deserializer: D) -> Result<Variant, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&str> for Variant

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<HashMap<String, Variant>> for Variant

Source§

fn from(value: HashMap<String, Variant>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Variant

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for HashMap<String, Variant>

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for SharedVariant

Source§

fn from(variant: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for String

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for Vec<Variant>

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for Vec<u8>

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for bool

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for f32

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for f64

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for i16

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for i32

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for i64

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for i8

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for u16

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for u32

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for u64

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Variant> for u8

Source§

fn from(value: Variant) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Variant>> for Variant

Source§

fn from(value: Vec<Variant>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<u8>> for Variant

Source§

fn from(value: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Variant

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Variant

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Variant

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Variant

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Variant

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Variant

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Variant

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Variant

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Variant

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Variant

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Variant

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<(String, Variant)> for Variant

Source§

fn from_iter<I: IntoIterator<Item = (String, Variant)>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Variant> for Variant

Source§

fn from_iter<I: IntoIterator<Item = Variant>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Index<&str> for Variant

Source§

type Output = Variant

The returned type after indexing.
Source§

fn index(&self, index: &str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for Variant

Source§

type Output = Variant

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<&str> for Variant

Source§

fn index_mut(&mut self, index: &str) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for Variant

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl PartialEq for Variant

Source§

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

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
Source§

impl StructuralPartialEq for Variant

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 = 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,