async_graphql

Trait InputType

Source
pub trait InputType:
    Send
    + Sync
    + Sized {
    type RawValueType;

    // 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

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