async_graphql

Trait InputType

Source
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§

Source

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§

Source

fn type_name() -> Cow<'static, str>

Type the name.

Source

fn create_type_info(registry: &mut Registry) -> String

Create type information in the registry and return qualified typename.

Source

fn parse(value: Option<Value>) -> InputValueResult<Self>

Parse from Value. None represents undefined.

Source

fn to_value(&self) -> Value

Convert to a Value for introspection.

Source

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Returns a reference to the raw value.

Provided Methods§

Source

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 Bson

Source§

type RawValueType = Bson

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Tz

Source§

type RawValueType = Tz

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Value

Source§

type RawValueType = Value

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for bool

Source§

type RawValueType = bool

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for char

Source§

type RawValueType = char

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for f32

Source§

type RawValueType = f32

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for f64

Source§

type RawValueType = f64

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for i8

Source§

type RawValueType = i8

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for i16

Source§

type RawValueType = i16

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for i32

Source§

type RawValueType = i32

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for i64

Source§

type RawValueType = i64

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for isize

Source§

type RawValueType = isize

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for u8

Source§

type RawValueType = u8

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for u16

Source§

type RawValueType = u16

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for u32

Source§

type RawValueType = u32

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for u64

Source§

type RawValueType = u64

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for usize

Source§

type RawValueType = usize

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Box<str>

Source§

type RawValueType = Box<str>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for String

Source§

type RawValueType = String

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Arc<str>

Source§

type RawValueType = Arc<str>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for BigDecimal

Source§

impl InputType for DateTime

Source§

type RawValueType = DateTime

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Document

Source§

type RawValueType = Document

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for ObjectId

Source§

type RawValueType = ObjectId

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Uuid

Source§

type RawValueType = Uuid

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Bytes

Source§

type RawValueType = Bytes

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for DateTime<FixedOffset>

Source§

impl InputType for DateTime<Local>

Source§

impl InputType for DateTime<Utc>

Source§

type RawValueType = DateTime<Utc>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NaiveDate

Source§

type RawValueType = NaiveDate

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NaiveDateTime

Source§

impl InputType for NaiveTime

Source§

type RawValueType = NaiveTime

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Decimal

Source§

type RawValueType = Decimal

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for SmolStr

Source§

type RawValueType = SmolStr

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Date

Source§

type RawValueType = Date

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for OffsetDateTime

Source§

impl InputType for PrimitiveDateTime

Source§

impl InputType for Url

Source§

type RawValueType = Url

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Uuid

Source§

type RawValueType = Uuid

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroI8

Source§

type RawValueType = NonZero<i8>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroI16

Source§

type RawValueType = NonZero<i16>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroI32

Source§

type RawValueType = NonZero<i32>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroI64

Source§

type RawValueType = NonZero<i64>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroIsize

Source§

type RawValueType = NonZero<isize>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroU8

Source§

type RawValueType = NonZero<u8>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroU16

Source§

type RawValueType = NonZero<u16>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroU32

Source§

type RawValueType = NonZero<u32>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroU64

Source§

type RawValueType = NonZero<u64>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for NonZeroUsize

Source§

type RawValueType = NonZero<usize>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for Duration

Source§

type RawValueType = TimeDelta

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl InputType for SecretString

Source§

impl<K, V> InputType for BTreeMap<K, V>

Source§

type RawValueType = BTreeMap<K, V>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl<K, V> InputType for HashMap<K, V>

Source§

type RawValueType = HashMap<K, V>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl<K, V, S> InputType for HashMap<K, V, S>

Source§

type RawValueType = HashMap<K, V, S>

Source§

fn type_name() -> Cow<'static, str>

Source§

fn create_type_info(registry: &mut Registry) -> String

Source§

fn parse(value: Option<Value>) -> InputValueResult<Self>

Source§

fn to_value(&self) -> Value

Source§

fn as_raw_value(&self) -> Option<&Self::RawValueType>

Source§

impl<T: InputType + Ord> InputType for BTreeSet<T>

Source§

impl<T: InputType + Hash + Eq> InputType for HashSet<T>

Source§

impl<T: InputType + Hash + Eq> InputType for HashSet<T>

Source§

impl<T: InputType + Zeroize> InputType for SecretBox<T>

Source§

impl<T: InputType> InputType for Option<T>

Source§

impl<T: InputType> InputType for Box<[T]>

Source§

impl<T: InputType> InputType for Box<T>

Source§

impl<T: InputType> InputType for LinkedList<T>

Source§

impl<T: InputType> InputType for VecDeque<T>

Source§

impl<T: InputType> InputType for Arc<[T]>

Source§

impl<T: InputType> InputType for Arc<T>

Source§

impl<T: InputType> InputType for Vec<T>

Source§

impl<T: InputType, const N: usize> InputType for [T; N]

Implementors§