pub enum Object {
Unit,
Bool(bool),
Number(Number),
String(String),
Wrapper(Box<Object>),
Array(Vec<Object>),
Map(Vec<(Object, Object)>),
Option(Option<Box<Object>>),
Variant {
name: String,
value: Box<Variant>,
},
}Variants§
Unit
Bool(bool)
Number(Number)
String(String)
Wrapper(Box<Object>)
Array(Vec<Object>)
Map(Vec<(Object, Object)>)
Option(Option<Box<Object>>)
Variant
Implementations§
Source§impl Object
impl Object
pub fn unit() -> Object
pub fn bool(value: bool) -> Object
pub fn number(value: impl Into<Number>) -> Object
pub fn string(value: impl ToString) -> Object
pub fn wrapper(value: impl Into<Object>) -> Object
pub fn array() -> Object
pub fn array_from<T>(value: impl IntoIterator<Item = T>) -> Object
pub fn item(self, value: impl Into<Object>) -> Object
pub fn map() -> Object
pub fn map_from<K, V>(value: impl IntoIterator<Item = (K, V)>) -> Object
pub fn property( self, key: impl Into<Object>, value: impl Into<Object>, ) -> Object
pub fn option(value: Option<impl Into<Object>>) -> Object
pub fn variant(name: impl ToString, value: Variant) -> Object
pub fn as_unit(&self) -> Option<()>
pub fn as_bool(&self) -> Option<bool>
pub fn as_number(&self) -> Option<&Number>
pub fn as_str(&self) -> Option<&str>
pub fn as_string(&self) -> Option<String>
pub fn as_wrapper(&self) -> Option<&Object>
pub fn as_array(&self) -> Option<&[Object]>
pub fn as_map(&self) -> Option<&[(Object, Object)]>
pub fn as_option(&self) -> Option<&Object>
pub fn as_variant(&self) -> Option<(&str, &Variant)>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Object
impl<'de> Deserialize<'de> for Object
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Object, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Object, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialOrd for Object
impl PartialOrd for Object
Source§impl Serialize for Object
impl Serialize for Object
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Object
impl StructuralPartialEq for Object
Auto Trait Implementations§
impl Freeze for Object
impl RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl UnwindSafe for Object
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.