pub trait Field {
type Type;
const NAME: &'static str;
}
pub trait HasField<FieldMarker> {
type Type;
}
pub trait HasInputField<FieldMarker, FieldType> {}
pub trait HasArgument<ArgumentMarker> {
type ArgumentType;
const NAME: &'static str;
}
pub trait IsScalar<SchemaType> {
type SchemaType;
}
impl<T, U: ?Sized> IsScalar<T> for &U
where
U: IsScalar<T>,
{
type SchemaType = U::SchemaType;
}
impl<T, U> IsScalar<Option<T>> for Option<U>
where
U: IsScalar<T>,
{
type SchemaType = Option<U::SchemaType>;
}
impl<T, U> IsScalar<Vec<T>> for Vec<U>
where
U: IsScalar<T>,
{
type SchemaType = Vec<U::SchemaType>;
}
impl<T, U> IsScalar<Vec<T>> for [U]
where
U: IsScalar<T>,
{
type SchemaType = Vec<U::SchemaType>;
}
impl<T, U, const SIZE: usize> IsScalar<Vec<T>> for [U; SIZE]
where
U: IsScalar<T>,
{
type SchemaType = Vec<U::SchemaType>;
}
impl<T, U: ?Sized> IsScalar<Box<T>> for Box<U>
where
U: IsScalar<T>,
{
type SchemaType = Box<U::SchemaType>;
}
impl<T, U: ?Sized> IsScalar<T> for std::borrow::Cow<'_, U>
where
U: IsScalar<T> + ToOwned,
{
type SchemaType = U::SchemaType;
}
impl IsScalar<bool> for bool {
type SchemaType = bool;
}
impl IsScalar<String> for String {
type SchemaType = String;
}
impl IsScalar<String> for str {
type SchemaType = String;
}
impl IsScalar<i32> for i32 {
type SchemaType = i32;
}
impl IsScalar<f64> for f64 {
type SchemaType = f64;
}
impl IsScalar<crate::Id> for crate::Id {
type SchemaType = crate::Id;
}
pub trait QueryRoot {}
pub trait MutationRoot {}
pub trait SubscriptionRoot {}
pub trait HasSubtype<Type> {}
pub trait NamedType {
const NAME: &'static str;
}
impl NamedType for i32 {
const NAME: &'static str = "Int";
}
impl NamedType for f64 {
const NAME: &'static str = "Float";
}
impl NamedType for String {
const NAME: &'static str = "String";
}
impl NamedType for bool {
const NAME: &'static str = "Boolean";
}
impl NamedType for crate::Id {
const NAME: &'static str = "ID";
}
pub trait InputObjectMarker {}
pub trait FieldDirective {
const NAME: &'static str;
}