Trait warpgrapher::engine::resolvers::FromInputValue
source · [−]pub trait FromInputValue<S = DefaultScalarValue> {
fn from_input_value(v: &InputValue<S>) -> Option<Self>;
fn from_implicit_null() -> Self { ... }
}
Expand description
Parse an unstructured input value into a Rust data type.
The conversion can fail, and must in that case return None. Implemented
automatically by the convenience proc macro graphql_scalar
or by deriving GraphQLEnum.
Must be implemented manually when manually exposing new enums or scalars.
Required methods
fn from_input_value(v: &InputValue<S>) -> Option<Self>
fn from_input_value(v: &InputValue<S>) -> Option<Self>
Performs the conversion.
Provided methods
fn from_implicit_null() -> Self
fn from_implicit_null() -> Self
Performs the conversion from an absent value (e.g. to distinguish between implicit and
explicit null). The default implementation just uses from_input_value
as if an explicit
null were provided. This conversion must not fail.