[][src]Enum cfg_lib::config::Value

pub enum Value {
    Base(ScalarValue),
    List(Vec<Value>),
    Mapping(HashMap<String, Value>),
    Config(Config),
}

This represents a value in a configuration.

Variants

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.

Methods

impl Value[src]

pub fn as_string(&self) -> String[src]

Expect a value to be a string and return it. Panic if it's not the expected type.

pub fn as_i64(&self) -> i64[src]

Expect a value to be an integer and return it. Panic if it's not the expected type.

pub fn as_f64(&self) -> f64[src]

Expect a value to be a floating-point value and return it. Panic if it's not the expected type.

pub fn as_c64(&self) -> Complex64[src]

Expect a value to be a complex number and return it. Panic if it's not the expected type.

pub fn as_bool(&self) -> bool[src]

Expect a value to be a Boolean and return it. Panic if it's not the expected type.

pub fn as_date(&self) -> NaiveDate[src]

Expect a value to be a date and return it. Panic if it's not the expected type.

pub fn as_datetime(&self) -> DateTime<FixedOffset>[src]

Expect a value to be a date/time and return it. Panic if it's not the expected type.

pub fn as_list(&self) -> Vec<Value>[src]

Expect a value to be a list and return it. Panic if it's not the expected type.

pub fn as_mapping(&self) -> HashMap<String, Value>[src]

Expect a value to be a mapping and return it. Panic if it's not the expected type.

pub fn as_config(&self) -> Config[src]

Expect a value to be a sub-configuration and return it. Panic if it's not the expected type.

Trait Implementations

impl Clone for Value[src]

impl Debug for Value[src]

impl<'_> From<&'_ str> for Value[src]

impl From<Complex<f64>> for Value[src]

impl From<DateTime<FixedOffset>> for Value[src]

impl From<NaiveDate> for Value[src]

impl From<String> for Value[src]

impl From<bool> for Value[src]

impl From<f64> for Value[src]

impl From<i64> for Value[src]

impl PartialEq<Value> for Value[src]

impl StructuralPartialEq for Value[src]

impl TryInto<Complex<f64>> for Value[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryInto<DateTime<FixedOffset>> for Value[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryInto<NaiveDate> for Value[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryInto<String> for Value[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryInto<f64> for Value[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryInto<i64> for Value[src]

type Error = &'static str

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.