pub trait FromInputValue<S = DefaultScalarValue>: Sized {
type Error;
// Required method
fn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>;
// Provided method
fn from_implicit_null() -> Result<Self, Self::Error> { ... }
}
Expand description
Parsing of an unstructured InputValue
into a Rust data type.
The conversion can fail, and must in that case return an Err
. Thus, not restricted in the
definition of this trait, the returned Err
should be convertible with the IntoFieldError
trait to fit well into the library machinery.
Required Associated Types§
Sourcetype Error
type Error
Type of this conversion error.
Thus, not restricted, it should be convertible with the IntoFieldError
trait to fit well
into the library machinery.
Required Methods§
Sourcefn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>
fn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>
Performs the conversion.
Provided Methods§
Sourcefn from_implicit_null() -> Result<Self, Self::Error>
fn from_implicit_null() -> Result<Self, Self::Error>
Performs the conversion from an absent value (e.g. to distinguish
between implicit and explicit null
).
The default implementation just calls from_input_value()
as if an
explicit null
was provided.
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.