pub trait FromScalarValue<'s, S: 's = DefaultScalarValue>: Sized {
type Error: IntoFieldError<S> + 's;
// Required method
fn from_scalar_value(v: &'s S) -> Result<Self, Self::Error>;
}Expand description
Parsing of a ScalarValue into a Rust data type.
The conversion can fail, and must in that case return an Err.
Use the ScalarValue::try_to() method as a shortcut for this conversion.
§Implementation
Implementing this trait for a type allows to specify this type directly in the from_input()
function when implementing a GraphQLScalar via derive macro.
Also, #[derive(GraphQLScalar)] automatically implements this trait
for a type.
Required Associated Types§
Sourcetype Error: IntoFieldError<S> + 's
type Error: IntoFieldError<S> + 's
Parsing error of a ScalarValue.
Required Methods§
Sourcefn from_scalar_value(v: &'s S) -> Result<Self, Self::Error>
fn from_scalar_value(v: &'s S) -> Result<Self, Self::Error>
Parses the provided ScalarValue.
§Errors
If this type cannot be parsed from the provided ScalarValue.
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<'___a, Tz, __S> FromScalarValue<'___a, __S> for DateTime<Tz>
Available on crate feature chrono only.
impl<'___a, Tz, __S> FromScalarValue<'___a, __S> for DateTime<Tz>
Available on crate feature
chrono only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for BigDecimalwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature bigdecimal only.
impl<'___a, __S> FromScalarValue<'___a, __S> for BigDecimalwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
bigdecimal only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for CompactStringwhere
__S: ScalarValue,
Self: '___a,
impl<'___a, __S> FromScalarValue<'___a, __S> for CompactStringwhere
__S: ScalarValue,
Self: '___a,
type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Datewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Datewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Datewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature time only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Datewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
time only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for DateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature bson only.
impl<'___a, __S> FromScalarValue<'___a, __S> for DateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
bson only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for DateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for DateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Decimalwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature rust_decimal only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Decimalwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
rust_decimal only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for NaiveDatewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature chrono only.
impl<'___a, __S> FromScalarValue<'___a, __S> for NaiveDatewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
chrono only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for NaiveDateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature chrono only.
impl<'___a, __S> FromScalarValue<'___a, __S> for NaiveDateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
chrono only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for NaiveTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature chrono only.
impl<'___a, __S> FromScalarValue<'___a, __S> for NaiveTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
chrono only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for ObjectIdwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature bson only.
impl<'___a, __S> FromScalarValue<'___a, __S> for ObjectIdwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
bson only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Offsetwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Offsetwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for OffsetDateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature time only.
impl<'___a, __S> FromScalarValue<'___a, __S> for OffsetDateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
time only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for PrimitiveDateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature time only.
impl<'___a, __S> FromScalarValue<'___a, __S> for PrimitiveDateTimewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
time only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Spanwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Spanwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Timewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Timewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Timewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature time only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Timewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
time only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for TimeZonewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for TimeZonewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Timestampwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Timestampwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Tzwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature chrono-tz only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Tzwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
chrono-tz only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for U8where
__S: ScalarValue,
Self: '___a,
Available on crate feature ruint only.
impl<'___a, __S> FromScalarValue<'___a, __S> for U8where
__S: ScalarValue,
Self: '___a,
Available on crate feature
ruint only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for U16where
__S: ScalarValue,
Self: '___a,
Available on crate feature ruint only.
impl<'___a, __S> FromScalarValue<'___a, __S> for U16where
__S: ScalarValue,
Self: '___a,
Available on crate feature
ruint only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for U32where
__S: ScalarValue,
Self: '___a,
Available on crate feature ruint only.
impl<'___a, __S> FromScalarValue<'___a, __S> for U32where
__S: ScalarValue,
Self: '___a,
Available on crate feature
ruint only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for U64where
__S: ScalarValue,
Self: '___a,
Available on crate feature ruint only.
impl<'___a, __S> FromScalarValue<'___a, __S> for U64where
__S: ScalarValue,
Self: '___a,
Available on crate feature
ruint only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for U128where
__S: ScalarValue,
Self: '___a,
Available on crate feature ruint only.
impl<'___a, __S> FromScalarValue<'___a, __S> for U128where
__S: ScalarValue,
Self: '___a,
Available on crate feature
ruint only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for U256where
__S: ScalarValue,
Self: '___a,
Available on crate feature ruint only.
impl<'___a, __S> FromScalarValue<'___a, __S> for U256where
__S: ScalarValue,
Self: '___a,
Available on crate feature
ruint only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Urlwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature url only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Urlwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
url only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for UtcOffsetwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature time only.
impl<'___a, __S> FromScalarValue<'___a, __S> for UtcOffsetwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
time only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Uuidwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature uuid only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Uuidwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
uuid only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for Zonedwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for Zonedwhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.type Error = FieldError<__S>
fn from_scalar_value(input: &'___a __S) -> Result<Self, Self::Error>
Source§impl<'s, S> FromScalarValue<'s, S> for &'s S
impl<'s, S> FromScalarValue<'s, S> for &'s S
Source§impl<'s, S> FromScalarValue<'s, S> for &'s strwhere
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
impl<'s, S> FromScalarValue<'s, S> for &'s strwhere
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
Source§impl<'s, S> FromScalarValue<'s, S> for Stringwhere
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
impl<'s, S> FromScalarValue<'s, S> for Stringwhere
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
Source§impl<'s, S> FromScalarValue<'s, S> for boolwhere
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
impl<'s, S> FromScalarValue<'s, S> for boolwhere
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
Source§impl<'s, S> FromScalarValue<'s, S> for f64where
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
impl<'s, S> FromScalarValue<'s, S> for f64where
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
Source§impl<'s, S> FromScalarValue<'s, S> for i32where
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
impl<'s, S> FromScalarValue<'s, S> for i32where
S: TryToPrimitive<'s, Self, Error: IntoFieldError<S>> + 's,
Source§impl<'s, T, S> FromScalarValue<'s, S> for Arc<T>where
S: ScalarValue,
T: FromScalarValue<'s, S> + 's,
impl<'s, T, S> FromScalarValue<'s, S> for Arc<T>where
S: ScalarValue,
T: FromScalarValue<'s, S> + 's,
Source§impl<'s, T, S> FromScalarValue<'s, S> for Box<T>where
S: ScalarValue,
T: FromScalarValue<'s, S> + 's,
impl<'s, T, S> FromScalarValue<'s, S> for Box<T>where
S: ScalarValue,
T: FromScalarValue<'s, S> + 's,
Implementors§
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for ArcStrwhere
__S: ScalarValue,
Self: '___a,
impl<'___a, __S> FromScalarValue<'___a, __S> for ArcStrwhere
__S: ScalarValue,
Self: '___a,
type Error = FieldError<__S>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for IDwhere
__S: ScalarValue,
Self: '___a,
impl<'___a, __S> FromScalarValue<'___a, __S> for IDwhere
__S: ScalarValue,
Self: '___a,
type Error = FieldError<__S>
Source§impl<'___a, __S> FromScalarValue<'___a, __S> for juniper::integrations::jiff::TimeZonewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature jiff only.
impl<'___a, __S> FromScalarValue<'___a, __S> for juniper::integrations::jiff::TimeZonewhere
__S: ScalarValue,
Self: '___a,
Available on crate feature
jiff only.