FromValue

Trait FromValue 

Source
pub trait FromValue: Sized {
    // Required method
    fn from_value(value: Value) -> Result<Self, ValueConversionError>;

    // Provided method
    fn from_value_ref(value: &Value) -> Result<Self, ValueConversionError> { ... }
}
Expand description

Trait for types that can be created from a Value.

Required Methods§

Source

fn from_value(value: Value) -> Result<Self, ValueConversionError>

Convert from a Value, returning an error if conversion fails.

Provided Methods§

Source

fn from_value_ref(value: &Value) -> Result<Self, ValueConversionError>

Convert from a Value reference, cloning as needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromValue for bool

Source§

impl FromValue for f32

Source§

impl FromValue for f64

Source§

impl FromValue for i32

Source§

impl FromValue for i64

Source§

impl FromValue for u32

Source§

impl FromValue for u64

Source§

impl FromValue for ()

Source§

impl FromValue for usize

Source§

impl FromValue for String

Source§

impl FromValue for Vec<u8>

Source§

impl<T: FromValue> FromValue for Option<T>

Source§

impl<T: FromValue> FromValue for Vec<T>

Source§

impl<T: FromValue> FromValue for HashMap<String, T>

Implementors§