Trait params::FromValue [] [src]

pub trait FromValue: Sized {
    fn from_value(value: &Value) -> Option<Self>;
}

An interface for converting from Value variants.

Required Methods

Returns Some if the conversion was successful, None otherwise.

Implementations on Foreign Types

impl FromValue for u8
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for u16
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for u32
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for u64
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for usize
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

impl FromValue for i8
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for i16
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for i32
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for i64
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for isize
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

impl FromValue for f32
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for f64
[src]

Casts from any of the numeric variants (I64, U64, F64) and converts from the String variant using std::str::FromStr.

[src]

impl FromValue for String
[src]

Converts from any of the flat variants (Null, Boolean, I64, U64, F64, String).

Null is converted to an empty string. All other variants make use of std::string::ToString, so the respective Display formatted results are used. For example, Boolean values are converted into either "false" or "true".

impl FromValue for bool
[src]

Converts from common representations of false and true.

  • Boolean values are mapped directly.
  • I64 and U64 map 0 and 1 to false and true respectively.
  • String maps "0", "f", "F", "false", "FALSE", "off", and "OFF" to false.
  • String maps "1", "t", "T", "true", "TRUE", "on", and "ON" to true.
  • All other variants return None.

[src]

impl<T: FromValue> FromValue for Option<T>
[src]

Converts the Null variant to None and delegates any other variants to T::from_value.

[src]

impl<T: FromValue> FromValue for Vec<T>
[src]

Converts from Array variant.

[src]

impl<T: FromValue> FromValue for BTreeMap<String, T>
[src]

Converts using Map::to_strict_map if the variant is Map, returns None otherwise.

Implementors