Skip to main content

FromValue

Trait FromValue 

Source
pub trait FromValue: Sized {
    // Required method
    fn from_value(value: &Value) -> Result<Self, TypeError>;
}
Expand description

A Value read as the type a field holds.

Strict: nothing here converts. Coercion happens once, in the merge, against the type the spec declared — a reader that converted as well would be a second set of rules for what a value means, which is the drift this crate exists to remove.

Required Methods§

Source

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

Read value, or say what was expected and what arrived.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FromValue for PathBuf

Source§

impl FromValue for String

Source§

impl FromValue for bool

Source§

impl FromValue for f32

Source§

impl FromValue for f64

Source§

impl FromValue for i8

Source§

impl FromValue for i16

Source§

impl FromValue for i32

Source§

impl FromValue for i64

Source§

impl FromValue for isize

Source§

impl FromValue for u8

Source§

impl FromValue for u16

Source§

impl FromValue for u32

Source§

impl FromValue for u64

Source§

impl FromValue for usize

Source§

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

Source§

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

Implementors§