pub trait InputType:
Send
+ Sync
+ Sized {
type RawValueType: ?Sized;
// Required methods
fn type_name() -> Cow<'static, str>;
fn create_type_info(registry: &mut Registry) -> String;
fn parse(value: Option<Value>) -> InputValueResult<Self>;
fn to_value(&self) -> Value;
fn as_raw_value(&self) -> Option<&Self::RawValueType>;
// Provided method
fn qualified_type_name() -> String { ... }
}Expand description
Represents a GraphQL input type.
Required Associated Types§
Sourcetype RawValueType: ?Sized
type RawValueType: ?Sized
The raw type used for validator.
Usually it is Self, but the wrapper type is its internal type.
For example:
i32::RawValueType is i32
Option<i32>::RawValueType is i32.
Required Methods§
Sourcefn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Create type information in the registry and return qualified typename.
Sourcefn parse(value: Option<Value>) -> InputValueResult<Self>
fn parse(value: Option<Value>) -> InputValueResult<Self>
Parse from Value. None represents undefined.
Sourcefn as_raw_value(&self) -> Option<&Self::RawValueType>
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Returns a reference to the raw value.
Provided Methods§
Sourcefn qualified_type_name() -> String
fn qualified_type_name() -> String
Qualified typename.
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.
Implementations on Foreign Types§
Source§impl InputType for BigDecimal
Available on crate feature bigdecimal only.
impl InputType for BigDecimal
Available on crate feature
bigdecimal only.type RawValueType = BigDecimal
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for DateTime<FixedOffset>
Available on crate feature chrono only.
impl InputType for DateTime<FixedOffset>
Available on crate feature
chrono only.type RawValueType = DateTime<FixedOffset>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for DateTime<Local>
Available on crate feature chrono only.
impl InputType for DateTime<Local>
Available on crate feature
chrono only.type RawValueType = DateTime<Local>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for DateTime<Utc>
Available on crate feature chrono only.
impl InputType for DateTime<Utc>
Available on crate feature
chrono only.type RawValueType = DateTime<Utc>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for NaiveDateTime
Available on crate feature chrono only.
impl InputType for NaiveDateTime
Available on crate feature
chrono only.type RawValueType = NaiveDateTime
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for OffsetDateTime
Available on crate feature time only.
impl InputType for OffsetDateTime
Available on crate feature
time only.type RawValueType = OffsetDateTime
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for PrimitiveDateTime
Available on crate feature time only.
impl InputType for PrimitiveDateTime
Available on crate feature
time only.type RawValueType = PrimitiveDateTime
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for NonZeroI16
impl InputType for NonZeroI16
Source§impl InputType for NonZeroI32
impl InputType for NonZeroI32
Source§impl InputType for NonZeroI64
impl InputType for NonZeroI64
Source§impl InputType for NonZeroIsize
impl InputType for NonZeroIsize
type RawValueType = NonZero<isize>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for NonZeroU16
impl InputType for NonZeroU16
Source§impl InputType for NonZeroU32
impl InputType for NonZeroU32
Source§impl InputType for NonZeroU64
impl InputType for NonZeroU64
Source§impl InputType for NonZeroUsize
impl InputType for NonZeroUsize
type RawValueType = NonZero<usize>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl InputType for SecretString
Available on crate feature secrecy only.
impl InputType for SecretString
Available on crate feature
secrecy only.type RawValueType = str
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<K, V> InputType for BTreeMap<K, V>
impl<K, V> InputType for BTreeMap<K, V>
type RawValueType = BTreeMap<K, V>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<K, V> InputType for HashMap<K, V>
Available on crate feature hashbrown only.
impl<K, V> InputType for HashMap<K, V>
Available on crate feature
hashbrown only.type RawValueType = HashMap<K, V>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<K, V, S> InputType for HashMap<K, V, S>
impl<K, V, S> InputType for HashMap<K, V, S>
type RawValueType = HashMap<K, V, S>
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType + Ord> InputType for BTreeSet<T>
impl<T: InputType + Ord> InputType for BTreeSet<T>
type RawValueType = BTreeSet<T>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType + Hash + Eq> InputType for HashSet<T>
impl<T: InputType + Hash + Eq> InputType for HashSet<T>
type RawValueType = HashSet<T>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType + Hash + Eq> InputType for HashSet<T>
Available on crate feature hashbrown only.
impl<T: InputType + Hash + Eq> InputType for HashSet<T>
Available on crate feature
hashbrown only.type RawValueType = HashSet<T>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType + Zeroize> InputType for SecretBox<T>
Available on crate feature secrecy only.
impl<T: InputType + Zeroize> InputType for SecretBox<T>
Available on crate feature
secrecy only.type RawValueType = <T as InputType>::RawValueType
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for Option<T>
impl<T: InputType> InputType for Option<T>
type RawValueType = <T as InputType>::RawValueType
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for Box<[T]>
impl<T: InputType> InputType for Box<[T]>
type RawValueType = Box<[T]>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for Box<T>
impl<T: InputType> InputType for Box<T>
type RawValueType = <T as InputType>::RawValueType
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<ConstValue>) -> InputValueResult<Self>
fn to_value(&self) -> ConstValue
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for LinkedList<T>
impl<T: InputType> InputType for LinkedList<T>
type RawValueType = LinkedList<T>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for VecDeque<T>
impl<T: InputType> InputType for VecDeque<T>
type RawValueType = VecDeque<T>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for Arc<[T]>
impl<T: InputType> InputType for Arc<[T]>
type RawValueType = Arc<[T]>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for Arc<T>
impl<T: InputType> InputType for Arc<T>
type RawValueType = <T as InputType>::RawValueType
fn type_name() -> Cow<'static, str>
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<ConstValue>) -> InputValueResult<Self>
fn to_value(&self) -> ConstValue
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType> InputType for Vec<T>
impl<T: InputType> InputType for Vec<T>
type RawValueType = Vec<T>
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Source§impl<T: InputType, const N: usize> InputType for [T; N]
impl<T: InputType, const N: usize> InputType for [T; N]
type RawValueType = [T; N]
fn type_name() -> Cow<'static, str>
fn qualified_type_name() -> String
fn create_type_info(registry: &mut Registry) -> String
fn parse(value: Option<Value>) -> InputValueResult<Self>
fn to_value(&self) -> Value
fn as_raw_value(&self) -> Option<&Self::RawValueType>
Implementors§
Source§impl<T: Num + Display + Send + Sync> InputType for StringNumber<T>
Available on crate feature string_number only.
impl<T: Num + Display + Send + Sync> InputType for StringNumber<T>
Available on crate feature
string_number only.