Enum serde_intermediate::value::object::Object
source · 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() -> Self
pub fn bool(value: bool) -> Self
pub fn number(value: impl Into<Number>) -> Self
pub fn string(value: impl ToString) -> Self
pub fn wrapper(value: impl Into<Object>) -> Self
pub fn array() -> Self
pub fn array_from<T: Into<Object>>(value: impl IntoIterator<Item = T>) -> Self
pub fn item(self, value: impl Into<Object>) -> Self
pub fn map() -> Self
pub fn map_from<K: Into<Object>, V: Into<Object>>( value: impl IntoIterator<Item = (K, V)> ) -> Self
pub fn property(self, key: impl Into<Object>, value: impl Into<Object>) -> Self
pub fn option(value: Option<impl Into<Object>>) -> Self
pub fn variant(name: impl ToString, value: Variant) -> Self
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<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<Object> for Object
impl PartialEq<Object> for Object
source§impl PartialOrd<Object> for Object
impl PartialOrd<Object> for Object
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Object
impl StructuralEq for Object
impl StructuralPartialEq for Object
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.