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§
Sourcefn from_value(value: &Value) -> Result<Self, TypeError>
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".