Enum rocket::config::Value [] [src]

pub enum Value {
    String(String),
    Integer(i64),
    Float(f64),
    Boolean(bool),
    Datetime(Datetime),
    Array(Vec<Value>),
    Table(BTreeMap<String, Value>),
}

Representation of a TOML value.

Variants

Represents a TOML string

Represents a TOML integer

Represents a TOML float

Represents a TOML boolean

Represents a TOML datetime

Represents a TOML array

Represents a TOML table

Methods

impl Value
[src]

[src]

Convert a T into toml::Value which is an enum that can represent any valid TOML data.

This conversion can fail if T's implementation of Serialize decides to fail, or if T contains a map with non-string keys.

[src]

Interpret a toml::Value as an instance of type T.

This conversion can fail if the structure of the Value does not match the structure expected by T, for example if T is a struct type but the Value contains something other than a TOML table. It can also fail if the structure is correct but T's implementation of Deserialize decides that something is wrong with the data, for example required struct fields are missing from the TOML map or some number is too big to fit in the expected primitive type.

[src]

Index into a TOML array or map. A string index can be used to access a value in a map, and a usize index can be used to access an element of an array.

Returns None if the type of self does not match the type of the index, for example if the index is a string and self is an array or a number. Also returns None if the given key does not exist in the map or the given index is not within the bounds of the array.

[src]

Mutably index into a TOML array or map. A string index can be used to access a value in a map, and a usize index can be used to access an element of an array.

Returns None if the type of self does not match the type of the index, for example if the index is a string and self is an array or a number. Also returns None if the given key does not exist in the map or the given index is not within the bounds of the array.

[src]

Extracts the integer value if it is an integer.

[src]

Tests whether this value is an integer

[src]

Extracts the float value if it is a float.

[src]

Tests whether this value is a float

[src]

Extracts the boolean value if it is a boolean.

[src]

Tests whether this value is a boolean

[src]

Extracts the string of this value if it is a string.

[src]

Tests if this value is a string

[src]

Extracts the datetime value if it is a datetime.

Note that a parsed TOML value will only contain ISO 8601 dates. An example date is:

1979-05-27T07:32:00Z

[src]

Tests whether this value is a datetime

[src]

Extracts the array value if it is an array.

[src]

Extracts the array value if it is an array.

[src]

Tests whether this value is an array

[src]

Extracts the table value if it is a table.

[src]

Extracts the table value if it is a table.

[src]

Extracts the table value if it is a table.

[src]

Tests whether this and another value have the same type.

[src]

Returns a human-readable representation of the type of this value.

Trait Implementations

impl<'de> Deserialize<'de> for Value
[src]

[src]

impl<I> Index<I> for Value where
    I: Index
[src]

[src]

impl Clone for Value
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl From<f64> for Value
[src]

[src]

Performs the conversion.

impl From<i64> for Value
[src]

[src]

Performs the conversion.

impl<S, V> From<BTreeMap<S, V>> for Value where
    S: Into<String>,
    V: Into<Value>, 
[src]

[src]

Performs the conversion.

impl From<f32> for Value
[src]

[src]

Performs the conversion.

impl From<i8> for Value
[src]

[src]

Performs the conversion.

impl From<u32> for Value
[src]

[src]

Performs the conversion.

impl<S, V> From<HashMap<S, V, RandomState>> for Value where
    S: Eq + Into<String> + Hash,
    V: Into<Value>, 
[src]

[src]

Performs the conversion.

impl From<i32> for Value
[src]

[src]

Performs the conversion.

impl<V> From<Vec<V>> for Value where
    V: Into<Value>, 
[src]

[src]

Performs the conversion.

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

[src]

Performs the conversion.

impl From<bool> for Value
[src]

[src]

Performs the conversion.

impl From<u8> for Value
[src]

[src]

Performs the conversion.

impl From<Datetime> for Value
[src]

[src]

Performs the conversion.

impl From<String> for Value
[src]

[src]

Performs the conversion.

impl<'de> IntoDeserializer<'de, Error> for Value
[src]

[src]

impl FromStr for Value
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more

impl<'de> Deserializer<'de> for Value
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

impl PartialEq<Value> for Value
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Debug for Value
[src]

[src]

Formats the value using the given formatter.

impl Serialize for Value
[src]

[src]

impl Display for Value
[src]

[src]

Formats the value using the given formatter. Read more

impl<I> IndexMut<I> for Value where
    I: Index
[src]

[src]