pub enum Value {
Scalar(ScalarCow<'static>),
Array(Vec<Value, Global>),
Object(Object),
State(State),
Nil,
}
Expand description
An enum to represent different value types
Variants§
Scalar(ScalarCow<'static>)
A scalar value.
Array(Vec<Value, Global>)
A sequence of Value
s.
Object(Object)
A sequence of key/Value
pairs.
State(State)
Query symbol.
Nil
Nothing.
Implementations§
source§impl Value
impl Value
sourcepub fn array<I>(iter: I) -> Valuewhere
I: IntoIterator<Item = Value>,
pub fn array<I>(iter: I) -> Valuewhere I: IntoIterator<Item = Value>,
Create as an Array
.
sourcepub fn into_scalar(self) -> Option<ScalarCow<'static>>
pub fn into_scalar(self) -> Option<ScalarCow<'static>>
Extracts the scalar value if it is a scalar.
sourcepub fn into_array(self) -> Option<Vec<Value, Global>>
pub fn into_array(self) -> Option<Vec<Value, Global>>
Extracts the array value if it is an array.
sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<Value, Global>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Value, Global>>
Extracts the array value as mutable if it is a object.
sourcepub fn into_object(self) -> Option<Object>
pub fn into_object(self) -> Option<Object>
Extracts the object value if it is a object.
sourcepub fn as_object_mut(&mut self) -> Option<&mut Object>
pub fn as_object_mut(&mut self) -> Option<&mut Object>
Extracts the object value as mutable if it is a object.
sourcepub fn into_state(self) -> Option<State>
pub fn into_state(self) -> Option<State>
Extracts the state if it is one
Trait Implementations§
source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Value, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<Value, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'s> PartialEq<&'s str> for Value
impl<'s> PartialEq<&'s str> for Value
source§impl PartialEq<Date> for Value
impl PartialEq<Date> for Value
source§impl PartialEq<DateTime> for Value
impl PartialEq<DateTime> for Value
source§impl PartialEq<KStringBase<Box<str, Global>>> for Value
impl PartialEq<KStringBase<Box<str, Global>>> for Value
source§impl<'s> PartialEq<KStringCowBase<'s, Box<str, Global>>> for Value
impl<'s> PartialEq<KStringCowBase<'s, Box<str, Global>>> for Value
source§impl<'s> PartialEq<KStringRef<'s>> for Value
impl<'s> PartialEq<KStringRef<'s>> for Value
source§fn eq(&self, other: &KStringRef<'s>) -> bool
fn eq(&self, other: &KStringRef<'s>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<String> for Value
impl PartialEq<String> for Value
source§impl PartialEq<Value> for Value
impl PartialEq<Value> for Value
source§impl<'v> PartialEq<Value> for ValueCow<'v>
impl<'v> PartialEq<Value> for ValueCow<'v>
source§impl<'v> PartialEq<ValueViewCmp<'v>> for Value
impl<'v> PartialEq<ValueViewCmp<'v>> for Value
source§fn eq(&self, other: &ValueViewCmp<'v>) -> bool
fn eq(&self, other: &ValueViewCmp<'v>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<bool> for Value
impl PartialEq<bool> for Value
source§impl PartialOrd<Value> for Value
impl PartialOrd<Value> for Value
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 moresource§impl Serialize for Value
impl Serialize for Value
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
source§impl ValueView for Value
impl ValueView for Value
source§fn render(&self) -> DisplayCow<'_>
fn render(&self) -> DisplayCow<'_>
A
Display
for a BoxedValue
rendered for the user.source§fn source(&self) -> DisplayCow<'_>
fn source(&self) -> DisplayCow<'_>
A
Display
for a Value
as source code.source§fn query_state(&self, state: State) -> bool
fn query_state(&self, state: State) -> bool
Query the value’s state
source§fn as_object(&self) -> Option<&dyn ObjectView>
fn as_object(&self) -> Option<&dyn ObjectView>
Extracts the object value if it is a object.
impl Eq for Value
Auto Trait Implementations§
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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