Trait async_graphql::InputType
source · pub trait InputType: Send + Sync + Sized {
type RawValueType;
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>;
fn qualified_type_name() -> String { ... }
}
Expand description
Represents a GraphQL input type.
Required Associated Types§
sourcetype RawValueType
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§
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.
Examples found in repository?
More examples
src/types/external/list/array.rs (line 12)
11 12 13 14 15 16 17 18 19 20 21 22
fn type_name() -> Cow<'static, str> {
Cow::Owned(format!("[{}]", T::qualified_type_name()))
}
fn qualified_type_name() -> String {
format!("[{}]!", T::qualified_type_name())
}
fn create_type_info(registry: &mut registry::Registry) -> String {
T::create_type_info(registry);
Self::qualified_type_name()
}
src/types/external/list/btree_set.rs (line 12)
11 12 13 14 15 16 17 18 19 20 21 22
fn type_name() -> Cow<'static, str> {
Cow::Owned(format!("[{}]", T::qualified_type_name()))
}
fn qualified_type_name() -> String {
format!("[{}]!", T::qualified_type_name())
}
fn create_type_info(registry: &mut registry::Registry) -> String {
T::create_type_info(registry);
Self::qualified_type_name()
}
src/types/external/list/hash_set.rs (line 12)
11 12 13 14 15 16 17 18 19 20 21 22
fn type_name() -> Cow<'static, str> {
Cow::Owned(format!("[{}]", T::qualified_type_name()))
}
fn qualified_type_name() -> String {
format!("[{}]!", T::qualified_type_name())
}
fn create_type_info(registry: &mut registry::Registry) -> String {
T::create_type_info(registry);
Self::qualified_type_name()
}
src/types/external/list/linked_list.rs (line 12)
11 12 13 14 15 16 17 18 19 20 21 22
fn type_name() -> Cow<'static, str> {
Cow::Owned(format!("[{}]", T::qualified_type_name()))
}
fn qualified_type_name() -> String {
format!("[{}]!", T::qualified_type_name())
}
fn create_type_info(registry: &mut registry::Registry) -> String {
T::create_type_info(registry);
Self::qualified_type_name()
}
Additional examples can be found in: