Enum rocket::config::Value [−][src]
pub enum Value {
String(String),
Integer(i64),
Float(f64),
Boolean(bool),
Datetime(Datetime),
Array(Vec<Value, Global>),
Table(BTreeMap<String, Value>),
}
Expand description
Representation of a TOML value.
Variants
String(String)
Represents a TOML string
Tuple Fields of String
0: String
Integer(i64)
Represents a TOML integer
Tuple Fields of Integer
0: i64
Float(f64)
Represents a TOML float
Tuple Fields of Float
0: f64
Boolean(bool)
Represents a TOML boolean
Tuple Fields of Boolean
0: bool
Datetime(Datetime)
Represents a TOML datetime
Tuple Fields of Datetime
0: Datetime
Represents a TOML array
Represents a TOML table
Implementations
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 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.
Extracts the table value if it is a table.
Extracts the table value if it is a table.
Tests whether this and another value have the same type.
Trait Implementations
pub fn deserialize<D>(
deserializer: D
) -> Result<Value, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<Value, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
The error type that can be returned if some error occurs during deserialization. Read more
Require the Deserializer
to figure out how to drive the visitor based
on what data type is in the input. Read more
Hint that the Deserialize
type is expecting an enum value with a
particular name and possible variants. Read more
Hint that the Deserialize
type is expecting an optional value. Read more
Hint that the Deserialize
type is expecting a newtype struct with a
particular name. Read more
pub fn deserialize_bool<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_bool<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a bool
value.
pub fn deserialize_u8<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_u8<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u8
value.
pub fn deserialize_u16<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_u16<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u16
value.
pub fn deserialize_u32<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_u32<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u32
value.
pub fn deserialize_u64<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_u64<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u64
value.
pub fn deserialize_i8<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_i8<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i8
value.
pub fn deserialize_i16<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_i16<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i16
value.
pub fn deserialize_i32<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_i32<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i32
value.
pub fn deserialize_i64<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_i64<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i64
value.
pub fn deserialize_f32<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_f32<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a f32
value.
pub fn deserialize_f64<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_f64<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a f64
value.
pub fn deserialize_char<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_char<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a char
value.
pub fn deserialize_str<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_str<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a string value and does
not benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
pub fn deserialize_string<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_string<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a string value and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
pub fn deserialize_unit<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_unit<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a unit value.
pub fn deserialize_seq<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_seq<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a sequence of values.
pub fn deserialize_bytes<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_bytes<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a byte array and does not
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
pub fn deserialize_byte_buf<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_byte_buf<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a byte array and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
pub fn deserialize_map<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_map<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a map of key-value pairs.
pub fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a unit struct with a
particular name. Read more
Hint that the Deserialize
type is expecting a tuple struct with a
particular name and number of fields. Read more
pub fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_struct<V>(
self,
name: &'static str,
fields: &'static [&'static str],
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a struct with a particular
name and fields. Read more
pub fn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a sequence of values and
knows how many values there are without looking at the serialized data. Read more
pub fn deserialize_ignored_any<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_ignored_any<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type needs to deserialize a value whose type
doesn’t matter because it is ignored. Read more
pub fn deserialize_identifier<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
pub fn deserialize_identifier<V>(
self,
visitor: V
) -> Result<<V as Visitor<'de>>::Value, <Value as Deserializer<'de>>::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting the name of a struct
field or the discriminant of an enum variant. 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
Performs the conversion.
type Deserializer = Value
type Deserializer = Value
The type of the deserializer being converted into.
Convert this value into a deserializer.
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Value
impl UnwindSafe for Value
Blanket Implementations
Mutably borrows from an owned value. Read more