pub enum Value {
String(String),
Integer(i64),
Boolean(bool),
StringArray(Vec<String>),
IntegerArray(Vec<i64>),
}
Variants§
Implementations§
Source§impl Value
impl Value
Sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true if the Value
is a String. Returns false otherwise.
For any Value on which is_string
returns true, as_str
is guaranteed
to return the string slice.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
If the Value
is a String, returns the associated str. Returns None
otherwise.
Sourcepub fn is_i64(&self) -> bool
pub fn is_i64(&self) -> bool
Returns true if the Value
is an integer between i64::MIN
and
i64::MAX
.
For any Value on which is_i64
returns true, as_i64
is guaranteed to
return the integer value.
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
If the Value
is an integer, represent it as i64. Returns
None otherwise.
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Returns true if the Value
is a Boolean. Returns false otherwise.
For any Value on which is_boolean
returns true, as_bool
is
guaranteed to return the boolean value.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
If the Value
is a Boolean, returns the associated bool. Returns None
otherwise.
Sourcepub fn is_str_arr(&self) -> bool
pub fn is_str_arr(&self) -> bool
Returns true if the Value
is a Vec
For any Value on which is_str_arr
returns true, as_str_arr
is
guaranteed to return the Vec
Sourcepub fn as_str_arr(&self) -> Option<&Vec<String>>
pub fn as_str_arr(&self) -> Option<&Vec<String>>
If the Value
is a Vec
Sourcepub fn is_i64_arr(&self) -> bool
pub fn is_i64_arr(&self) -> bool
Returns true if the Value
is a Vec
For any Value on which is_i64_arr
returns true, as_i64_arr
is
guaranteed to return the Vec
Sourcepub fn as_i64_arr(&self) -> Option<&Vec<i64>>
pub fn as_i64_arr(&self) -> Option<&Vec<i64>>
If the Value
is a Vec