Reimpl renewed traits machinery for Box [skip ci]

This commit is contained in:
tyranron 2022-06-08 19:17:46 +02:00
parent 5a62ddfbf2
commit 017e87c791
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
24 changed files with 230 additions and 189 deletions

View file

@ -1294,6 +1294,7 @@ impl<'r, S: 'r> Registry<'r, S> {
ScalarMeta::new::<T>(Cow::Owned(name.to_string())) ScalarMeta::new::<T>(Cow::Owned(name.to_string()))
} }
/*
/// Builds a [`ScalarMeta`] information for the specified [`graphql::Type`]. /// Builds a [`ScalarMeta`] information for the specified [`graphql::Type`].
/// ///
/// [`graphql::Type`]: resolve::Type /// [`graphql::Type`]: resolve::Type
@ -1317,7 +1318,7 @@ impl<'r, S: 'r> Registry<'r, S> {
{ {
// TODO: Allow using references. // TODO: Allow using references.
ScalarMeta::new_unsized::<T, _>(T::type_name(info).to_owned()) ScalarMeta::new_unsized::<T, _>(T::type_name(info).to_owned())
} }*/
/// Creates a [`ListMeta`] type. /// Creates a [`ListMeta`] type.
/// ///

View file

@ -8,8 +8,8 @@ pub use crate::{
executor::Variables, executor::Variables,
}; };
pub trait Interface<S> /*
/*: OutputType<S> pub trait Interface<S>: OutputType<S>
+ resolve::TypeName + resolve::TypeName
+ resolve::ConcreteTypeName + resolve::ConcreteTypeName
+ resolve::Value<S> + resolve::Value<S>
@ -18,25 +18,20 @@ pub trait Interface<S>
+ resolve::ConcreteValueAsync<S> + resolve::ConcreteValueAsync<S>
+ resolve::Field<S> + resolve::Field<S>
+ resolve::FieldAsync<S> + resolve::FieldAsync<S>
*/
{ {
fn assert_interface(); fn assert_interface();
} }
pub trait Object<S> pub trait Object<S>: OutputType<S>
/*: OutputType<S>
+ resolve::TypeName + resolve::TypeName
+ resolve::ConcreteTypeName + resolve::ConcreteTypeName
+ resolve::Value<S> + resolve::Value<S>
+ resolve::ValueAsync<S> + resolve::ValueAsync<S>
+ resolve::Field<S> + resolve::Field<S>
+ resolve::FieldAsync<S> + resolve::FieldAsync<S>
*/
{ {
fn assert_object(); fn assert_object();
} }*/
pub trait Scalar< pub trait Scalar<
'inp, 'inp,
@ -52,17 +47,18 @@ pub trait Scalar<
fn assert_scalar(); fn assert_scalar();
} }
/*
pub trait Union<S> pub trait Union<S>
/*: OutputType<S> OutputType<S>
+ resolve::TypeName + resolve::TypeName
+ resolve::ConcreteTypeName + resolve::ConcreteTypeName
+ resolve::Value<S> + resolve::Value<S>
+ resolve::ValueAsync<S> + resolve::ValueAsync<S>
+ resolve::ConcreteValue<S> + resolve::ConcreteValue<S>
+ resolve::ConcreteValueAsync<S> */ + resolve::ConcreteValueAsync<S>
{ {
fn assert_union(); fn assert_union();
} }*/
pub trait InputType< pub trait InputType<
'inp, 'inp,

View file

@ -74,10 +74,7 @@ pub use crate::{
LookAheadSelection, LookAheadValue, OwnedExecutor, Registry, ValuesStream, Variables, LookAheadSelection, LookAheadValue, OwnedExecutor, Registry, ValuesStream, Variables,
}, },
introspection::IntrospectionFormat, introspection::IntrospectionFormat,
macros::{ macros::helper::subscription::{ExtractTypeFromStream, IntoFieldResult},
helper::subscription::{ExtractTypeFromStream, IntoFieldResult},
input_value as graphql_input_value, value as graphql_value, vars as graphql_vars,
},
parser::{ParseError, ScalarToken, Spanning}, parser::{ParseError, ScalarToken, Spanning},
schema::{ schema::{
meta, meta,

View file

@ -83,7 +83,8 @@
/// [`InputValue::Scalar`]: crate::graphql::InputValue::Scalar /// [`InputValue::Scalar`]: crate::graphql::InputValue::Scalar
/// [`InputValue::Variable`]: crate::graphql::InputValue::Variable /// [`InputValue::Variable`]: crate::graphql::InputValue::Variable
/// [`Spanning::unlocated`]: crate::Spanning::unlocated /// [`Spanning::unlocated`]: crate::Spanning::unlocated
macro_rules! input_value { #[macro_export]
macro_rules! graphql_input_value {
/////////// ///////////
// Array // // Array //
/////////// ///////////
@ -379,7 +380,7 @@ macro_rules! input_value {
} }
#[doc(inline)] #[doc(inline)]
pub(super) use input_value; pub use graphql_input_value as input_value;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View file

@ -43,7 +43,8 @@
/// ///
/// [`graphql::Value`]: crate::graphql::Value /// [`graphql::Value`]: crate::graphql::Value
/// [`Value::Object`]: crate::graphql::Value::Object /// [`Value::Object`]: crate::graphql::Value::Object
macro_rules! value { #[macro_export]
macro_rules! graphql_value {
/////////// ///////////
// Array // // Array //
/////////// ///////////
@ -270,7 +271,7 @@ macro_rules! value {
} }
#[doc(inline)] #[doc(inline)]
pub(super) use value; pub use graphql_value as value;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View file

@ -24,7 +24,8 @@
/// ///
/// [`graphql::input_value!`]: crate::graphql::input_value /// [`graphql::input_value!`]: crate::graphql::input_value
/// [`graphql::Variables`]: crate::graphql::Variables /// [`graphql::Variables`]: crate::graphql::Variables
macro_rules! vars { #[macro_export]
macro_rules! graphql_vars {
//////////// ////////////
// Object // // Object //
//////////// ////////////
@ -196,7 +197,7 @@ macro_rules! vars {
} }
#[doc(inline)] #[doc(inline)]
pub(super) use vars; pub use graphql_vars as vars;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View file

@ -6,9 +6,9 @@ pub mod helper;
#[macro_use] #[macro_use]
pub mod reflect; pub mod reflect;
mod input_value; mod graphql_input_value;
mod value; mod graphql_value;
mod vars; mod graphql_vars;
#[doc(inline)] #[doc(inline)]
pub use self::{input_value::input_value, value::value, vars::vars}; pub use self::{graphql_input_value::input_value, graphql_value::value, graphql_vars::vars};

View file

@ -1,13 +1,16 @@
//! Compile-time reflection of Rust types into GraphQL types. //! Compile-time reflection of Rust types into GraphQL types.
use std::{rc::Rc, sync::Arc};
use futures::future::BoxFuture; use futures::future::BoxFuture;
use crate::{ use crate::{
reflect::{ Arguments as FieldArguments, ExecutionResult, Executor, GraphQLValue, Nullable, ScalarValue,
can_be_subtype, fnv1a128, str_eq, str_exists_in_arr, type_len_with_wrapped_val, wrap, };
Argument, Arguments, FieldName, Name, Names, Type, Types, WrappedValue,
}, pub use crate::reflect::{
Arguments as FieldArguments, ExecutionResult, Executor, GraphQLValue, ScalarValue, Nullable, can_be_subtype, fnv1a128, str_eq, str_exists_in_arr, type_len_with_wrapped_val, Argument,
Arguments, FieldName, Name, Names, Type, Types, WrappedValue,
}; };
/// Naming of a [GraphQL object][1], [scalar][2] or [interface][3] [`Type`]. /// Naming of a [GraphQL object][1], [scalar][2] or [interface][3] [`Type`].

View file

@ -5,7 +5,7 @@ use crate::behavior;
#[doc(inline)] #[doc(inline)]
pub use self::macros::{ pub use self::macros::{
assert_field, assert_field_args, assert_field_type, assert_has_field, assert_implemented_for, assert_field, assert_field_args, assert_field_type, assert_has_field, assert_implemented_for,
assert_interfaces_impls, checked_hash, const_concat, format_type, assert_interfaces_impls, const_concat, format_type,
}; };
/// Name of a [GraphQL type][0] in a GraphQL schema. /// Name of a [GraphQL type][0] in a GraphQL schema.
@ -329,7 +329,8 @@ mod macros {
/// types referencing this interface in the `impl = ...` attribute argument. /// types referencing this interface in the `impl = ...` attribute argument.
/// ///
/// Symmetrical to [`assert_interfaces_impls!`]. /// Symmetrical to [`assert_interfaces_impls!`].
macro_rules! assert_implemented_for { #[macro_export]
macro_rules! reflect_assert_implemented_for {
($behavior: ty, $implementor: ty $(, $interfaces: ty)* $(,)?) => { ($behavior: ty, $implementor: ty $(, $interfaces: ty)* $(,)?) => {
const _: () = { const _: () = {
$({ $({
@ -356,7 +357,8 @@ mod macros {
/// referencing this type in `#[graphql::interface(for = ...)]` attribute. /// referencing this type in `#[graphql::interface(for = ...)]` attribute.
/// ///
/// Symmetrical to [`assert_implemented_for!`]. /// Symmetrical to [`assert_implemented_for!`].
macro_rules! assert_interfaces_impls { #[macro_export]
macro_rules! reflect_assert_interfaces_impls {
($behavior: ty, $interface: ty $(, $implementers: ty)* $(,)?) => { ($behavior: ty, $interface: ty $(, $implementers: ty)* $(,)?) => {
const _: () = { const _: () = {
$({ $({
@ -390,7 +392,8 @@ mod macros {
/// [`Field`]: super::Field /// [`Field`]: super::Field
/// [`Type`]: super::Type /// [`Type`]: super::Type
/// [0]: https://spec.graphql.org/October2021#IsValidImplementation() /// [0]: https://spec.graphql.org/October2021#IsValidImplementation()
macro_rules! assert_field { #[macro_export]
macro_rules! reflect_assert_field {
( (
$base_ty: ty, $base_ty: ty,
$impl_ty: ty, $impl_ty: ty,
@ -409,7 +412,7 @@ mod macros {
/// [`Field`]: super::Field /// [`Field`]: super::Field
/// [0]: https://spec.graphql.org/October2021#IsValidImplementationFieldType() /// [0]: https://spec.graphql.org/October2021#IsValidImplementationFieldType()
#[macro_export] #[macro_export]
macro_rules! assert_field_type { macro_rules! reflect_assert_field_type {
( (
$base_ty: ty, $base_ty: ty,
$impl_ty: ty, $impl_ty: ty,
@ -492,7 +495,7 @@ mod macros {
/// [`Field`]: super::Field /// [`Field`]: super::Field
/// [0]: https://spec.graphql.org/October2021#sel-IAHZhCHCDEEFAAADHD8Cxob /// [0]: https://spec.graphql.org/October2021#sel-IAHZhCHCDEEFAAADHD8Cxob
#[macro_export] #[macro_export]
macro_rules! assert_field_args { macro_rules! reflect_assert_field_args {
( (
$base_ty: ty, $base_ty: ty,
$impl_ty: ty, $impl_ty: ty,
@ -677,7 +680,8 @@ mod macros {
/// ///
/// [`Field`]: super::Field /// [`Field`]: super::Field
/// [`fnv1a128`]: super::fnv1a128 /// [`fnv1a128`]: super::fnv1a128
macro_rules! assert_has_field { #[macro_export]
macro_rules! reflect_assert_has_field {
( (
$field_name: expr, $field_name: expr,
$impl_ty: ty, $impl_ty: ty,
@ -703,7 +707,8 @@ mod macros {
} }
/// Concatenates `const` [`str`](prim@str)s in a `const` context. /// Concatenates `const` [`str`](prim@str)s in a `const` context.
macro_rules! const_concat { #[macro_export]
macro_rules! reflect_const_concat {
($($s:expr),* $(,)?) => {{ ($($s:expr),* $(,)?) => {{
const LEN: usize = 0 $(+ $s.as_bytes().len())*; const LEN: usize = 0 $(+ $s.as_bytes().len())*;
const CNT: usize = [$($s),*].len(); const CNT: usize = [$($s),*].len();
@ -745,7 +750,8 @@ mod macros {
/// ///
/// [`Type`]: super::Type /// [`Type`]: super::Type
/// [`WrappedValue`]: super::WrappedValue /// [`WrappedValue`]: super::WrappedValue
macro_rules! format_type { #[macro_export]
macro_rules! reflect_format_type {
($ty: expr, $wrapped_value: expr $(,)?) => {{ ($ty: expr, $wrapped_value: expr $(,)?) => {{
const TYPE: ($crate::reflect::Type, $crate::reflect::WrappedValue) = const TYPE: ($crate::reflect::Type, $crate::reflect::WrappedValue) =
($ty, $wrapped_value); ($ty, $wrapped_value);
@ -831,8 +837,12 @@ mod macros {
} }
#[doc(inline)] #[doc(inline)]
pub(super) use { pub use {
assert_field, assert_field_args, assert_field_type, assert_has_field, reflect_assert_field as assert_field, reflect_assert_field_args as assert_field_args,
assert_implemented_for, assert_interfaces_impls, checked_hash, const_concat, format_type, reflect_assert_field_type as assert_field_type,
reflect_assert_has_field as assert_has_field,
reflect_assert_implemented_for as assert_implemented_for,
reflect_assert_interfaces_impls as assert_interfaces_impls,
reflect_const_concat as const_concat, reflect_format_type as format_type,
}; };
} }

View file

@ -7,8 +7,8 @@ use crate::{
#[doc(inline)] #[doc(inline)]
pub use crate::types::{ pub use crate::types::{
arc::TryFromInputValue as InputValueAsArc, r#box::TryFromInputValue as InputValueAsBox, /*arc::TryFromInputValue as InputValueAsArc,*/ r#box::TryFromInputValue as InputValueAsBox,
r#ref::TryFromInputValue as InputValueAsRef, rc::TryFromInputValue as InputValueAsRc, /*r#ref::TryFromInputValue as InputValueAsRef, rc::TryFromInputValue as InputValueAsRc,*/
}; };
pub trait Type<TypeInfo: ?Sized, ScalarValue, Behavior: ?Sized = behavior::Standard> { pub trait Type<TypeInfo: ?Sized, ScalarValue, Behavior: ?Sized = behavior::Standard> {
@ -24,7 +24,7 @@ pub trait TypeName<TypeInfo: ?Sized, Behavior: ?Sized = behavior::Standard> {
fn type_name(type_info: &TypeInfo) -> &str; fn type_name(type_info: &TypeInfo) -> &str;
} }
pub trait ConcreteTypeName<TypeInfo: ?Sized> { pub trait ConcreteTypeName<TypeInfo: ?Sized, Behavior: ?Sized = behavior::Standard> {
fn concrete_type_name<'i>(&self, type_info: &'i TypeInfo) -> &'i str; fn concrete_type_name<'i>(&self, type_info: &'i TypeInfo) -> &'i str;
} }
@ -74,7 +74,13 @@ pub trait ConcreteValue<
) -> ExecutionResult<ScalarValue>; ) -> ExecutionResult<ScalarValue>;
} }
pub trait ConcreteValueAsync<TypeInfo: ?Sized, Context: ?Sized, ScalarValue> { pub trait ConcreteValueAsync<
TypeInfo: ?Sized,
Context: ?Sized,
ScalarValue,
Behavior: ?Sized = behavior::Standard,
>
{
fn resolve_concrete_value_async<'r>( fn resolve_concrete_value_async<'r>(
&'r self, &'r self,
type_name: &str, type_name: &str,
@ -171,7 +177,7 @@ pub trait InputValueOwned<ScalarValue, Behavior: ?Sized = behavior::Standard>:
{ {
} }
impl<T, S, B: ?Sized> InputValueOwned<S, B> for T where T: for<'i> InputValue<'i, S, B> {} impl<T, SV, BH: ?Sized> InputValueOwned<SV, BH> for T where T: for<'i> InputValue<'i, SV, BH> {}
pub trait ScalarToken<ScalarValue, Behavior: ?Sized = behavior::Standard> { pub trait ScalarToken<ScalarValue, Behavior: ?Sized = behavior::Standard> {
fn parse_scalar_token(token: parser::ScalarToken<'_>) -> Result<ScalarValue, ParseError<'_>>; fn parse_scalar_token(token: parser::ScalarToken<'_>) -> Result<ScalarValue, ParseError<'_>>;

View file

@ -448,6 +448,7 @@ impl<'a, S> ScalarMeta<'a, S> {
} }
} }
/*
/// Builds a new [`ScalarMeta`] information with the specified `name`. /// Builds a new [`ScalarMeta`] information with the specified `name`.
// TODO: Use `impl Into<Cow<'a, str>>` argument once feature // TODO: Use `impl Into<Cow<'a, str>>` argument once feature
// `explicit_generic_args_with_impl_trait` hits stable: // `explicit_generic_args_with_impl_trait` hits stable:
@ -483,7 +484,7 @@ impl<'a, S> ScalarMeta<'a, S> {
try_parse_fn: try_parse_unsized_fn::<S, T>, try_parse_fn: try_parse_unsized_fn::<S, T>,
parse_fn: <T as resolve::ScalarToken<S>>::parse_scalar_token, parse_fn: <T as resolve::ScalarToken<S>>::parse_scalar_token,
} }
} }*/
/// Sets the `description` of this [`ScalarMeta`] type. /// Sets the `description` of this [`ScalarMeta`] type.
/// ///
@ -837,6 +838,7 @@ where
.map_err(T::Error::into_field_error) .map_err(T::Error::into_field_error)
} }
/*
fn try_parse_fn_new<S, T>(v: &InputValue<S>) -> Result<(), FieldError<S>> fn try_parse_fn_new<S, T>(v: &InputValue<S>) -> Result<(), FieldError<S>>
where where
T: resolve::InputValueOwned<S>, T: resolve::InputValueOwned<S>,
@ -854,3 +856,4 @@ where
.map(drop) .map(drop)
.map_err(T::Error::into_field_error) .map_err(T::Error::into_field_error)
} }
*/

View file

@ -10,6 +10,7 @@ use crate::{
IntoFieldError, Registry, Selection, IntoFieldError, Registry, Selection,
}; };
/*
impl<T, Info, S> resolve::Type<Info, S> for Arc<T> impl<T, Info, S> resolve::Type<Info, S> for Arc<T>
where where
T: resolve::Type<Info, S> + ?Sized, T: resolve::Type<Info, S> + ?Sized,
@ -278,3 +279,4 @@ where
{ {
const VALUE: reflect::WrappedValue = T::VALUE; const VALUE: reflect::WrappedValue = T::VALUE;
} }
*/

View file

@ -11,6 +11,7 @@ use crate::{
use super::iter; use super::iter;
/*
impl<T, Info, S, const N: usize> resolve::Type<Info, S> for [T; N] impl<T, Info, S, const N: usize> resolve::Type<Info, S> for [T; N]
where where
T: resolve::Type<Info, S>, T: resolve::Type<Info, S>,
@ -114,3 +115,4 @@ where
{ {
const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE); const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE);
} }
*/

View file

@ -1,278 +1,278 @@
//! GraphQL implementation for [`Box`]. //! GraphQL implementation for [`Box`].
use crate::{ use crate::{
graphql, behavior, graphql,
meta::MetaType, meta::MetaType,
parser::{ParseError, ScalarToken}, parser::{ParseError, ScalarToken},
reflect, resolve, Arguments, BoxFuture, DefaultScalarValue, ExecutionResult, Executor, reflect, resolve, Arguments, BoxFuture, ExecutionResult, Executor, IntoFieldError, Registry,
IntoFieldError, Registry, Selection, Selection,
}; };
impl<T, Info, S> resolve::Type<Info, S> for Box<T> impl<T, TI, SV, BH> resolve::Type<TI, SV, BH> for Box<T>
where where
T: resolve::Type<Info, S> + ?Sized, T: resolve::Type<TI, SV, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
BH: ?Sized,
{ {
fn meta<'r>(registry: &mut Registry<'r, S>, info: &Info) -> MetaType<'r, S> fn meta<'r>(registry: &mut Registry<'r, SV>, info: &TI) -> MetaType<'r, SV>
where where
S: 'r, SV: 'r,
{ {
T::meta(registry, info) T::meta(registry, info)
} }
} }
impl<T, Info> resolve::TypeName<Info> for Box<T> impl<T, TI, BH> resolve::TypeName<TI, BH> for Box<T>
where where
T: resolve::TypeName<Info> + ?Sized, T: resolve::TypeName<TI, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
BH: ?Sized,
{ {
fn type_name(info: &Info) -> &str { fn type_name(info: &TI) -> &str {
T::type_name(info) T::type_name(info)
} }
} }
impl<T, Info> resolve::ConcreteTypeName<Info> for Box<T> impl<T, TI, BH> resolve::ConcreteTypeName<TI, BH> for Box<T>
where where
T: resolve::ConcreteTypeName<Info> + ?Sized, T: resolve::ConcreteTypeName<TI, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
BH: ?Sized,
{ {
fn concrete_type_name<'i>(&self, info: &'i Info) -> &'i str { fn concrete_type_name<'i>(&self, info: &'i TI) -> &'i str {
(**self).concrete_type_name(info) (**self).concrete_type_name(info)
} }
} }
impl<T, Info, Ctx, S> resolve::Value<Info, Ctx, S> for Box<T> impl<T, TI, CX, SV, BH> resolve::Value<TI, CX, SV, BH> for Box<T>
where where
T: resolve::Value<Info, Ctx, S> + ?Sized, T: resolve::Value<TI, CX, SV, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
Ctx: ?Sized, CX: ?Sized,
BH: ?Sized,
{ {
fn resolve_value( fn resolve_value(
&self, &self,
selection_set: Option<&[Selection<'_, S>]>, selection_set: Option<&[Selection<'_, SV>]>,
info: &Info, type_info: &TI,
executor: &Executor<Ctx, S>, executor: &Executor<CX, SV>,
) -> ExecutionResult<S> { ) -> ExecutionResult<SV> {
(**self).resolve_value(selection_set, info, executor) (**self).resolve_value(selection_set, type_info, executor)
} }
} }
impl<T, Info, Ctx, S> resolve::ValueAsync<Info, Ctx, S> for Box<T> impl<T, TI, CX, SV, BH> resolve::ValueAsync<TI, CX, SV, BH> for Box<T>
where where
T: resolve::ValueAsync<Info, Ctx, S> + ?Sized, T: resolve::ValueAsync<TI, CX, SV, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
Ctx: ?Sized, CX: ?Sized,
BH: ?Sized,
{ {
fn resolve_value_async<'r>( fn resolve_value_async<'r>(
&'r self, &'r self,
selection_set: Option<&'r [Selection<'_, S>]>, selection_set: Option<&'r [Selection<'_, SV>]>,
info: &'r Info, type_info: &'r TI,
executor: &'r Executor<Ctx, S>, executor: &'r Executor<CX, SV>,
) -> BoxFuture<'r, ExecutionResult<S>> { ) -> BoxFuture<'r, ExecutionResult<SV>> {
(**self).resolve_value_async(selection_set, info, executor) (**self).resolve_value_async(selection_set, type_info, executor)
} }
} }
impl<T, Info, Ctx, S> resolve::ConcreteValue<Info, Ctx, S> for Box<T> impl<T, TI, CX, SV, BH> resolve::ConcreteValue<TI, CX, SV, BH> for Box<T>
where where
T: resolve::ConcreteValue<Info, Ctx, S> + ?Sized, T: resolve::ConcreteValue<TI, CX, SV, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
Ctx: ?Sized, CX: ?Sized,
BH: ?Sized,
{ {
fn resolve_concrete_value( fn resolve_concrete_value(
&self, &self,
type_name: &str, type_name: &str,
selection_set: Option<&[Selection<'_, S>]>, selection_set: Option<&[Selection<'_, SV>]>,
info: &Info, type_info: &TI,
executor: &Executor<Ctx, S>, executor: &Executor<CX, SV>,
) -> ExecutionResult<S> { ) -> ExecutionResult<SV> {
(**self).resolve_concrete_value(type_name, selection_set, info, executor) (**self).resolve_concrete_value(type_name, selection_set, type_info, executor)
} }
} }
impl<T, Info, Ctx, S> resolve::ConcreteValueAsync<Info, Ctx, S> for Box<T> impl<T, TI, CX, SV, BH> resolve::ConcreteValueAsync<TI, CX, SV, BH> for Box<T>
where where
T: resolve::ConcreteValueAsync<Info, Ctx, S> + ?Sized, T: resolve::ConcreteValueAsync<TI, CX, SV, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
Ctx: ?Sized, CX: ?Sized,
BH: ?Sized,
{ {
fn resolve_concrete_value_async<'r>( fn resolve_concrete_value_async<'r>(
&'r self, &'r self,
type_name: &str, type_name: &str,
selection_set: Option<&'r [Selection<'_, S>]>, selection_set: Option<&'r [Selection<'_, SV>]>,
info: &'r Info, type_info: &'r TI,
executor: &'r Executor<Ctx, S>, executor: &'r Executor<CX, SV>,
) -> BoxFuture<'r, ExecutionResult<S>> { ) -> BoxFuture<'r, ExecutionResult<SV>> {
(**self).resolve_concrete_value_async(type_name, selection_set, info, executor) (**self).resolve_concrete_value_async(type_name, selection_set, type_info, executor)
} }
} }
impl<T, Info, Ctx, S> resolve::Field<Info, Ctx, S> for Box<T> impl<T, TI, CX, SV, BH> resolve::Field<TI, CX, SV, BH> for Box<T>
where where
T: resolve::Field<Info, Ctx, S> + ?Sized, T: resolve::Field<TI, CX, SV, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
Ctx: ?Sized, CX: ?Sized,
BH: ?Sized,
{ {
fn resolve_field( fn resolve_field(
&self, &self,
field_name: &str, field_name: &str,
arguments: &Arguments<S>, arguments: &Arguments<SV>,
info: &Info, type_info: &TI,
executor: &Executor<Ctx, S>, executor: &Executor<CX, SV>,
) -> ExecutionResult<S> { ) -> ExecutionResult<SV> {
(**self).resolve_field(field_name, arguments, info, executor) (**self).resolve_field(field_name, arguments, type_info, executor)
} }
} }
impl<T, Info, Ctx, S> resolve::FieldAsync<Info, Ctx, S> for Box<T> impl<T, TI, CX, SV, BH> resolve::FieldAsync<TI, CX, SV, BH> for Box<T>
where where
T: resolve::FieldAsync<Info, Ctx, S> + ?Sized, T: resolve::FieldAsync<TI, CX, SV, BH> + ?Sized,
Info: ?Sized, TI: ?Sized,
Ctx: ?Sized, CX: ?Sized,
BH: ?Sized,
{ {
fn resolve_field_async<'r>( fn resolve_field_async<'r>(
&'r self, &'r self,
field_name: &'r str, field_name: &'r str,
arguments: &'r Arguments<S>, arguments: &'r Arguments<SV>,
info: &'r Info, type_info: &'r TI,
executor: &'r Executor<Ctx, S>, executor: &'r Executor<CX, SV>,
) -> BoxFuture<'r, ExecutionResult<S>> { ) -> BoxFuture<'r, ExecutionResult<SV>> {
(**self).resolve_field_async(field_name, arguments, info, executor) (**self).resolve_field_async(field_name, arguments, type_info, executor)
} }
} }
impl<T, S> resolve::ToInputValue<S> for Box<T> impl<T, SV, BH> resolve::ToInputValue<SV, BH> for Box<T>
where where
T: resolve::ToInputValue<S> + ?Sized, T: resolve::ToInputValue<SV, BH> + ?Sized,
BH: ?Sized,
{ {
fn to_input_value(&self) -> graphql::InputValue<S> { fn to_input_value(&self) -> graphql::InputValue<SV> {
(**self).to_input_value() (**self).to_input_value()
} }
} }
impl<'inp, T, S> resolve::InputValue<'inp, S> for Box<T> impl<'i, T, SV, BH> resolve::InputValue<'i, SV, BH> for Box<T>
where where
T: resolve::InputValueAsBox<'inp, S> + ?Sized, T: resolve::InputValueAsBox<'i, SV, BH> + ?Sized,
S: 'inp, SV: 'i,
BH: ?Sized,
{ {
type Error = <T as resolve::InputValueAsBox<'inp, S>>::Error; type Error = T::Error;
fn try_from_input_value(v: &'inp graphql::InputValue<S>) -> Result<Self, Self::Error> { fn try_from_input_value(v: &'i graphql::InputValue<SV>) -> Result<Self, Self::Error> {
<T as resolve::InputValueAsBox<'inp, S>>::try_from_input_value(v) T::try_from_input_value(v)
} }
fn try_from_implicit_null() -> Result<Self, Self::Error> { fn try_from_implicit_null() -> Result<Self, Self::Error> {
<T as resolve::InputValueAsBox<'inp, S>>::try_from_implicit_null() T::try_from_implicit_null()
} }
} }
pub trait TryFromInputValue<'input, S: 'input = DefaultScalarValue> { pub trait TryFromInputValue<'input, ScalarValue: 'input, Behavior: ?Sized = behavior::Standard> {
type Error: IntoFieldError<S>; type Error: IntoFieldError<ScalarValue>;
fn try_from_input_value(v: &'input graphql::InputValue<S>) -> Result<Box<Self>, Self::Error>; fn try_from_input_value(
v: &'input graphql::InputValue<ScalarValue>,
) -> Result<Box<Self>, Self::Error>;
fn try_from_implicit_null() -> Result<Box<Self>, Self::Error> { fn try_from_implicit_null() -> Result<Box<Self>, Self::Error> {
Self::try_from_input_value(&graphql::InputValue::<S>::Null) Self::try_from_input_value(&graphql::InputValue::<ScalarValue>::Null)
} }
} }
impl<'inp, T, S> TryFromInputValue<'inp, S> for T impl<'i, T, SV, BH> TryFromInputValue<'i, SV, BH> for T
where where
T: resolve::InputValue<'inp, S>, T: resolve::InputValue<'i, SV, BH>,
S: 'inp, SV: 'i,
BH: ?Sized,
{ {
type Error = <T as resolve::InputValue<'inp, S>>::Error; type Error = T::Error;
fn try_from_input_value(v: &'inp graphql::InputValue<S>) -> Result<Box<Self>, Self::Error> { fn try_from_input_value(v: &'i graphql::InputValue<SV>) -> Result<Box<Self>, Self::Error> {
<T as resolve::InputValue<'inp, S>>::try_from_input_value(v).map(Box::new) T::try_from_input_value(v).map(Box::new)
} }
fn try_from_implicit_null() -> Result<Box<Self>, Self::Error> { fn try_from_implicit_null() -> Result<Box<Self>, Self::Error> {
<T as resolve::InputValue<'inp, S>>::try_from_implicit_null().map(Box::new) T::try_from_implicit_null().map(Box::new)
} }
} }
impl<T, S> resolve::ScalarToken<S> for Box<T> impl<T, SV, BH> resolve::ScalarToken<SV, BH> for Box<T>
where where
T: resolve::ScalarToken<S> + ?Sized, T: resolve::ScalarToken<SV, BH> + ?Sized,
BH: ?Sized,
{ {
fn parse_scalar_token(token: ScalarToken<'_>) -> Result<S, ParseError<'_>> { fn parse_scalar_token(token: ScalarToken<'_>) -> Result<SV, ParseError<'_>> {
T::parse_scalar_token(token) T::parse_scalar_token(token)
} }
} }
impl<'i, T, Info, S: 'i> graphql::InputType<'i, Info, S> for Box<T> impl<'i, T, TI, SV, BH> graphql::InputType<'i, TI, SV, BH> for Box<T>
where where
T: graphql::InputType<'i, Info, S> + resolve::InputValueAsBox<'i, S> + ?Sized, T: graphql::InputType<'i, TI, SV, BH>,
Info: ?Sized, TI: ?Sized,
SV: 'i,
BH: ?Sized,
{ {
fn assert_input_type() { fn assert_input_type() {
T::assert_input_type() T::assert_input_type()
} }
} }
impl<T, S> graphql::OutputType<S> for Box<T> impl<T, TI, CX, SV, BH> graphql::OutputType<TI, CX, SV, BH> for Box<T>
where where
T: graphql::OutputType<S> + ?Sized, T: graphql::OutputType<TI, CX, SV, BH> + ?Sized,
TI: ?Sized,
CX: ?Sized,
BH: ?Sized,
{ {
fn assert_output_type() { fn assert_output_type() {
T::assert_output_type() T::assert_output_type()
} }
} }
impl<T, S> graphql::Interface<S> for Box<T> impl<'i, T, TI, CX, SV, BH> graphql::Scalar<'i, TI, CX, SV, BH> for Box<T>
where where
T: graphql::Interface<S> + ?Sized, T: graphql::Scalar<'i, TI, CX, SV, BH>,
{ TI: ?Sized,
fn assert_interface() { CX: ?Sized,
T::assert_interface() SV: 'i,
} BH: ?Sized,
}
impl<T, S> graphql::Object<S> for Box<T>
where
T: graphql::Object<S> + ?Sized,
{
fn assert_object() {
T::assert_object()
}
}
impl<T, S> graphql::Scalar<S> for Box<T>
where
T: graphql::Scalar<S> + ?Sized,
{ {
fn assert_scalar() { fn assert_scalar() {
T::assert_scalar() T::assert_scalar()
} }
} }
impl<T, S> graphql::Union<S> for Box<T> impl<T, BH> reflect::BaseType<BH> for Box<T>
where where
T: graphql::Union<S> + ?Sized, T: reflect::BaseType<BH> + ?Sized,
{ BH: ?Sized,
fn assert_union() {
T::assert_union()
}
}
impl<T, S> reflect::BaseType<S> for Box<T>
where
T: reflect::BaseType<S> + ?Sized,
{ {
const NAME: reflect::Type = T::NAME; const NAME: reflect::Type = T::NAME;
} }
impl<T, S> reflect::BaseSubTypes<S> for Box<T> impl<T, BH> reflect::BaseSubTypes<BH> for Box<T>
where where
T: reflect::BaseSubTypes<S> + ?Sized, T: reflect::BaseSubTypes<BH> + ?Sized,
BH: ?Sized,
{ {
const NAMES: reflect::Types = T::NAMES; const NAMES: reflect::Types = T::NAMES;
} }
impl<T, S> reflect::WrappedType<S> for Box<T> impl<T, BH> reflect::WrappedType<BH> for Box<T>
where where
T: reflect::WrappedType<S> + ?Sized, T: reflect::WrappedType<BH> + ?Sized,
BH: ?Sized,
{ {
const VALUE: reflect::WrappedValue = T::VALUE; const VALUE: reflect::WrappedValue = T::VALUE;
} }

View file

@ -2,6 +2,7 @@
use crate::{graphql, resolve, ExecutionResult, Executor, Selection}; use crate::{graphql, resolve, ExecutionResult, Executor, Selection};
/*
pub fn resolve_list<'t, T, S, Info, Ctx, I>( pub fn resolve_list<'t, T, S, Info, Ctx, I>(
iter: I, iter: I,
selection_set: Option<&[Selection<'_, S>]>, selection_set: Option<&[Selection<'_, S>]>,
@ -65,3 +66,4 @@ where
} }
Ok(graphql::Value::list(values)) Ok(graphql::Value::list(values))
} }
*/

View file

@ -272,6 +272,7 @@ impl<T: Clone> Nullable<&mut T> {
} }
} }
/*
impl<T, Info, S> resolve::Type<Info, S> for Nullable<T> impl<T, Info, S> resolve::Type<Info, S> for Nullable<T>
where where
T: resolve::Type<Info, S>, T: resolve::Type<Info, S>,
@ -395,6 +396,7 @@ where
const VALUE: reflect::WrappedValue = reflect::wrap::nullable(T::VALUE); const VALUE: reflect::WrappedValue = reflect::wrap::nullable(T::VALUE);
} }
*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
impl<S, T> GraphQLType<S> for Nullable<T> impl<S, T> GraphQLType<S> for Nullable<T>

View file

@ -8,7 +8,7 @@ use crate::{
schema::meta::MetaType, schema::meta::MetaType,
BoxFuture, Selection, BoxFuture, Selection,
}; };
/*
impl<T, Info, S> resolve::Type<Info, S> for Option<T> impl<T, Info, S> resolve::Type<Info, S> for Option<T>
where where
T: resolve::Type<Info, S>, T: resolve::Type<Info, S>,
@ -127,3 +127,4 @@ where
{ {
const VALUE: reflect::WrappedValue = reflect::wrap::nullable(T::VALUE); const VALUE: reflect::WrappedValue = reflect::wrap::nullable(T::VALUE);
} }
*/

View file

@ -10,6 +10,7 @@ use crate::{
IntoFieldError, Registry, Selection, IntoFieldError, Registry, Selection,
}; };
/*
impl<T, Info, S> resolve::Type<Info, S> for Rc<T> impl<T, Info, S> resolve::Type<Info, S> for Rc<T>
where where
T: resolve::Type<Info, S> + ?Sized, T: resolve::Type<Info, S> + ?Sized,
@ -278,3 +279,4 @@ where
{ {
const VALUE: reflect::WrappedValue = T::VALUE; const VALUE: reflect::WrappedValue = T::VALUE;
} }
*/

View file

@ -10,6 +10,7 @@ use crate::{
IntoFieldError, Registry, Selection, IntoFieldError, Registry, Selection,
}; };
/*
impl<'me, T, Info, S> resolve::Type<Info, S> for &'me T impl<'me, T, Info, S> resolve::Type<Info, S> for &'me T
where where
T: resolve::Type<Info, S> + ?Sized, T: resolve::Type<Info, S> + ?Sized,
@ -265,3 +266,4 @@ where
{ {
const VALUE: reflect::WrappedValue = T::VALUE; const VALUE: reflect::WrappedValue = T::VALUE;
} }
*/

View file

@ -9,6 +9,7 @@ use crate::{
reflect, resolve, Arguments, BoxFuture, ExecutionResult, Executor, Registry, Selection, reflect, resolve, Arguments, BoxFuture, ExecutionResult, Executor, Registry, Selection,
}; };
/*
impl<'me, T, Info, S> resolve::Type<Info, S> for &'me mut T impl<'me, T, Info, S> resolve::Type<Info, S> for &'me mut T
where where
T: resolve::Type<Info, S> + ?Sized, T: resolve::Type<Info, S> + ?Sized,
@ -225,3 +226,4 @@ where
{ {
const VALUE: reflect::WrappedValue = T::VALUE; const VALUE: reflect::WrappedValue = T::VALUE;
} }
*/

View file

@ -2,6 +2,7 @@
use crate::reflect; use crate::reflect;
/*
impl<T, E, S> reflect::BaseType<S> for Result<T, E> impl<T, E, S> reflect::BaseType<S> for Result<T, E>
where where
T: reflect::BaseType<S>, T: reflect::BaseType<S>,
@ -22,3 +23,4 @@ where
{ {
const VALUE: reflect::WrappedValue = T::VALUE; const VALUE: reflect::WrappedValue = T::VALUE;
} }
*/

View file

@ -11,6 +11,7 @@ use crate::{
use super::iter; use super::iter;
/*
impl<T, Info, S> resolve::Type<Info, S> for [T] impl<T, Info, S> resolve::Type<Info, S> for [T]
where where
T: resolve::Type<Info, S>, T: resolve::Type<Info, S>,
@ -71,7 +72,6 @@ where
} }
} }
/*
impl<T, S> graphql::InputType<S> for [T] impl<T, S> graphql::InputType<S> for [T]
where where
T: graphql::InputType<S>, T: graphql::InputType<S>,
@ -80,7 +80,7 @@ where
T::assert_input_type() T::assert_input_type()
} }
} }
*/
impl<T, S> graphql::OutputType<S> for [T] impl<T, S> graphql::OutputType<S> for [T]
where where
@ -111,3 +111,4 @@ where
{ {
const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE); const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE);
} }
*/

View file

@ -13,6 +13,7 @@ use crate::{
reflect, resolve, BoxFuture, ExecutionResult, Executor, Registry, ScalarValue, Selection, reflect, resolve, BoxFuture, ExecutionResult, Executor, Registry, ScalarValue, Selection,
}; };
/*
impl<Info: ?Sized, S: ScalarValue> resolve::Type<Info, S> for str { impl<Info: ?Sized, S: ScalarValue> resolve::Type<Info, S> for str {
fn meta<'r>(registry: &mut Registry<'r, S>, info: &Info) -> MetaType<'r, S> fn meta<'r>(registry: &mut Registry<'r, S>, info: &Info) -> MetaType<'r, S>
where where
@ -146,3 +147,4 @@ impl<S> reflect::BaseSubTypes<S> for str {
impl<S> reflect::WrappedType<S> for str { impl<S> reflect::WrappedType<S> for str {
const VALUE: reflect::WrappedValue = reflect::wrap::SINGULAR; const VALUE: reflect::WrappedValue = reflect::wrap::SINGULAR;
} }
*/

View file

@ -9,6 +9,7 @@ use crate::{
use super::iter; use super::iter;
/*
impl<T, Info, S> resolve::Type<Info, S> for Vec<T> impl<T, Info, S> resolve::Type<Info, S> for Vec<T>
where where
T: resolve::Type<Info, S>, T: resolve::Type<Info, S>,
@ -69,7 +70,7 @@ where
} }
} }
/*
impl<'i, T, Info, S> graphql::InputType<'i, Info, S> for Vec<T> impl<'i, T, Info, S> graphql::InputType<'i, Info, S> for Vec<T>
where where
T: graphql::InputType<'i, Info, S>, T: graphql::InputType<'i, Info, S>,
@ -79,7 +80,7 @@ where
T::assert_input_type() T::assert_input_type()
} }
} }
*/
impl<T, S> graphql::OutputType<S> for Vec<T> impl<T, S> graphql::OutputType<S> for Vec<T>
where where
@ -110,3 +111,4 @@ where
{ {
const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE); const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE);
} }
*/