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

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]

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.

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.

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.

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.

Extracts the integer value if it is an integer.

Tests whether this value is an integer.

Extracts the float value if it is a float.

Tests whether this value is a float.

Extracts the boolean value if it is a boolean.

Tests whether this value is a boolean.

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

Tests if this value is a string.

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

Tests whether this value is a datetime.

Extracts the array value if it is an array.

Extracts the array value if it is an array.

Tests whether this value is an array.

Extracts the table value if it is a table.

Extracts the table value if it is a table.

Tests whether this value is a table.

Tests whether this and another value have the same type.

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

Trait Implementations

impl From<i64> for Value
[src]

impl From<String> for Value
[src]

impl From<f64> for Value
[src]

impl From<i32> for Value
[src]

impl From<u8> for Value
[src]

impl From<i8> for Value
[src]

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

impl From<u32> for Value
[src]

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

impl From<f32> for Value
[src]

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

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

impl From<bool> for Value
[src]

impl From<Datetime> for Value
[src]

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

impl FromStr for Value
[src]

The associated error which can be returned from parsing.

impl PartialEq<Value> for Value
[src]

impl Clone for Value
[src]

Performs copy-assignment from source. Read more

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

The type of the deserializer being converted into.

impl Display for Value
[src]

impl Debug for Value
[src]

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

The returned type after indexing.

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

impl Serialize for Value
[src]

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

The error type that can be returned if some error occurs during deserialization. Read more

Hint that the Deserialize type is expecting an i128 value. Read more

Hint that the Deserialize type is expecting an u128 value. Read more

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more

Auto Trait Implementations

impl Send for Value

impl Sync for Value

Blanket Implementations

impl<T> From for T
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Typeable for T where
    T: Any

Get the TypeId of this object.

impl<T> IntoCollection for T

impl<T, I> AsResult for T where
    I: Input, 

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]