Trait params::FromValue
[−]
[src]
pub trait FromValue: Sized { fn from_value(value: &Value) -> Option<Self>; }
An interface for converting from Value
variants.
Required Methods
fn from_value(value: &Value) -> Option<Self>
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
.
fn from_value(value: &Value) -> Option<u8>
[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
.
fn from_value(value: &Value) -> Option<u16>
[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
.
fn from_value(value: &Value) -> Option<u32>
[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
.
fn from_value(value: &Value) -> Option<u64>
[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
.
fn from_value(value: &Value) -> Option<usize>
[src]
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
.
fn from_value(value: &Value) -> Option<i8>
[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
.
fn from_value(value: &Value) -> Option<i16>
[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
.
fn from_value(value: &Value) -> Option<i32>
[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
.
fn from_value(value: &Value) -> Option<i64>
[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
.
fn from_value(value: &Value) -> Option<isize>
[src]
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
.
fn from_value(value: &Value) -> Option<f32>
[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
.
fn from_value(value: &Value) -> Option<f64>
[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"
.
fn from_value(value: &Value) -> Option<String>
[src]
impl FromValue for bool
[src]
Converts from common representations of false
and true
.
Boolean
values are mapped directly.I64
andU64
map0
and1
tofalse
andtrue
respectively.String
maps"0"
,"f"
,"F"
,"false"
,"FALSE"
,"off"
, and"OFF"
tofalse
.String
maps"1"
,"t"
,"T"
,"true"
,"TRUE"
,"on"
, and"ON"
totrue
.- All other variants return
None
.
fn from_value(value: &Value) -> Option<bool>
[src]
impl<T: FromValue> FromValue for Option<T>
[src]
Converts the Null
variant to None
and delegates any other variants to T::from_value
.
fn from_value(value: &Value) -> Option<Option<T>>
[src]
impl<T: FromValue> FromValue for Vec<T>
[src]
Converts from Array
variant.
fn from_value(value: &Value) -> Option<Vec<T>>
[src]
impl<T: FromValue> FromValue for BTreeMap<String, T>
[src]
Converts using Map::to_strict_map
if the variant is Map
, returns None
otherwise.