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 input value into a Rust data type.

The conversion can fail, and must in that case return Err. Thus not restricted in the definition of this trait, the returned Err should be convertible with IntoFieldError to fit well into the library machinery.

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 Associated Types§

source

type Error

Type of this conversion error.

Thus not restricted, it should be convertible with IntoFieldError to fit well into the library machinery.

Required Methods§

source

fn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>

Performs the conversion.

Provided Methods§

source

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<S, T: FromInputValue<S>> FromInputValue<S> for Option<T>

§

type Error = <T as FromInputValue<S>>::Error

source§

fn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>

source§

impl<S: ScalarValue, T: FromInputValue<S>> FromInputValue<S> for Vec<T>

§

type Error = FromInputValueVecError<T, S>

source§

fn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>

source§

impl<T, S> FromInputValue<S> for Box<T>
where S: ScalarValue, T: FromInputValue<S>,

source§

impl<T, S> FromInputValue<S> for Arc<T>
where S: ScalarValue, T: FromInputValue<S>,

source§

impl<T, S, const N: usize> FromInputValue<S> for [T; N]
where T: FromInputValue<S>, S: ScalarValue,

§

type Error = FromInputValueArrayError<T, S>

source§

fn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>

source§

impl<Tz, __S> FromInputValue<__S> for DateTime<Tz>

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for Tz
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for bool
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for f64
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for i32
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for String
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for BigDecimal
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for DateTime
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for ObjectId
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for NaiveDate
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for NaiveDateTime
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for NaiveTime
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for Decimal
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for Date
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for OffsetDateTime
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for PrimitiveDateTime
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for Time
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for UtcOffset
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for Url
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

source§

impl<__S> FromInputValue<__S> for Uuid
where __S: ScalarValue,

§

type Error = FieldError<__S>

source§

fn from_input_value(input: &InputValue<__S>) -> Result<Self, Self::Error>

Implementors§

source§

impl<S, T: FromInputValue<S>> FromInputValue<S> for Nullable<T>

§

type Error = <T as FromInputValue<S>>::Error

source§

impl<__S> FromInputValue<__S> for TypeKind
where __S: ScalarValue,

source§

impl<__S> FromInputValue<__S> for Episode
where __S: ScalarValue,

source§

impl<__S> FromInputValue<__S> for ID
where __S: ScalarValue,

§

type Error = FieldError<__S>