pub enum Value {
Base(ScalarValue),
List(Vec<Value>),
Mapping(HashMap<String, Value>),
Config(Config),
}
Expand description
This represents a value in a configuration.
Variants§
Base(ScalarValue)
These are the scalar values.
List(Vec<Value>)
This is a list of values.
Mapping(HashMap<String, Value>)
This is a mapping of strings to values.
Config(Config)
This is a nested (sub-) configuration.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_string(&self) -> String
pub fn as_string(&self) -> String
Expect a value to be a string and return it. Panic if it’s not the expected type.
Sourcepub fn as_i64(&self) -> i64
pub fn as_i64(&self) -> i64
Expect a value to be an integer and return it. Panic if it’s not the expected type.
Sourcepub fn as_f64(&self) -> f64
pub fn as_f64(&self) -> f64
Expect a value to be a floating-point value and return it. Panic if it’s not the expected type.
Sourcepub fn as_c64(&self) -> Complex64
pub fn as_c64(&self) -> Complex64
Expect a value to be a complex number and return it. Panic if it’s not the expected type.
Sourcepub fn as_bool(&self) -> bool
pub fn as_bool(&self) -> bool
Expect a value to be a Boolean and return it. Panic if it’s not the expected type.
Sourcepub fn as_date(&self) -> NaiveDate
pub fn as_date(&self) -> NaiveDate
Expect a value to be a date and return it. Panic if it’s not the expected type.
Sourcepub fn as_datetime(&self) -> DateTime<FixedOffset>
pub fn as_datetime(&self) -> DateTime<FixedOffset>
Expect a value to be a date/time and return it. Panic if it’s not the expected type.
Sourcepub fn as_list(&self) -> Vec<Value>
pub fn as_list(&self) -> Vec<Value>
Expect a value to be a list and return it. Panic if it’s not the expected type.
Sourcepub fn as_mapping(&self) -> HashMap<String, Value>
pub fn as_mapping(&self) -> HashMap<String, Value>
Expect a value to be a mapping and return it. Panic if it’s not the expected type.