pub enum Value {
String(String),
Number(f64),
Bool(bool),
Array(Vec<Value>),
Object(HashMap<String, Value>),
Null,
Duration(Duration),
Reference(String),
Identifier(String),
}Variants§
String(String)
Number(f64)
Bool(bool)
Array(Vec<Value>)
Object(HashMap<String, Value>)
Null
Duration(Duration)
Reference(String)
Identifier(String)
Implementations§
Source§impl Value
impl Value
pub fn value_type(&self) -> ValueType
pub fn is_string(&self) -> bool
pub fn is_number(&self) -> bool
pub fn is_boolean(&self) -> bool
pub fn is_array(&self) -> bool
pub fn is_object(&self) -> bool
pub fn is_null(&self) -> bool
pub fn as_string(&self) -> Option<&str>
pub fn as_number(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
pub fn as_str(&self) -> Option<&str>
pub fn as_boolean(&self) -> Option<bool>
pub fn as_array(&self) -> Option<&[Value]>
pub fn as_object(&self) -> Option<&HashMap<String, Value>>
pub fn get(&self, key: &str) -> Option<&Value>
pub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
pub fn get_string(&self, key: &str) -> Option<&str>
pub fn get_number(&self, key: &str) -> Option<f64>
pub fn get_boolean(&self, key: &str) -> Option<bool>
pub fn get_array(&self, key: &str) -> Option<&[Value]>
pub fn get_object(&self, key: &str) -> Option<&HashMap<String, Value>>
pub fn to_string(&self) -> String
pub fn to_json(&self) -> Result<String, Error>
pub fn to_yaml(&self) -> Result<String, Error>
pub fn from_json(json_value: Value) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
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
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.