From 017e87c79110cb18c97f633f372b8533e1436981 Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 8 Jun 2022 19:17:46 +0200 Subject: [PATCH] Reimpl renewed traits machinery for `Box` [skip ci] --- juniper/src/executor/mod.rs | 3 +- juniper/src/graphql/mod.rs | 20 +- juniper/src/lib.rs | 5 +- ...{input_value.rs => graphql_input_value.rs} | 5 +- .../src/macros/{value.rs => graphql_value.rs} | 5 +- .../src/macros/{vars.rs => graphql_vars.rs} | 5 +- juniper/src/macros/mod.rs | 8 +- juniper/src/macros/reflect.rs | 13 +- juniper/src/reflect/mod.rs | 34 ++- juniper/src/resolve/mod.rs | 16 +- juniper/src/schema/meta.rs | 5 +- juniper/src/types/arc.rs | 2 + juniper/src/types/array.rs | 2 + juniper/src/types/box.rs | 268 +++++++++--------- juniper/src/types/iter.rs | 2 + juniper/src/types/nullable.rs | 2 + juniper/src/types/option.rs | 3 +- juniper/src/types/rc.rs | 2 + juniper/src/types/ref.rs | 2 + juniper/src/types/ref_mut.rs | 2 + juniper/src/types/result.rs | 2 + juniper/src/types/slice.rs | 5 +- juniper/src/types/str.rs | 2 + juniper/src/types/vec.rs | 6 +- 24 files changed, 230 insertions(+), 189 deletions(-) rename juniper/src/macros/{input_value.rs => graphql_input_value.rs} (99%) rename juniper/src/macros/{value.rs => graphql_value.rs} (99%) rename juniper/src/macros/{vars.rs => graphql_vars.rs} (99%) diff --git a/juniper/src/executor/mod.rs b/juniper/src/executor/mod.rs index 0dc3118b..7603acb1 100644 --- a/juniper/src/executor/mod.rs +++ b/juniper/src/executor/mod.rs @@ -1294,6 +1294,7 @@ impl<'r, S: 'r> Registry<'r, S> { ScalarMeta::new::(Cow::Owned(name.to_string())) } + /* /// Builds a [`ScalarMeta`] information for the specified [`graphql::Type`]. /// /// [`graphql::Type`]: resolve::Type @@ -1317,7 +1318,7 @@ impl<'r, S: 'r> Registry<'r, S> { { // TODO: Allow using references. ScalarMeta::new_unsized::(T::type_name(info).to_owned()) - } + }*/ /// Creates a [`ListMeta`] type. /// diff --git a/juniper/src/graphql/mod.rs b/juniper/src/graphql/mod.rs index 1dfe2234..8fa9391a 100644 --- a/juniper/src/graphql/mod.rs +++ b/juniper/src/graphql/mod.rs @@ -8,8 +8,8 @@ pub use crate::{ executor::Variables, }; -pub trait Interface -/*: OutputType +/* +pub trait Interface: OutputType + resolve::TypeName + resolve::ConcreteTypeName + resolve::Value @@ -18,25 +18,20 @@ pub trait Interface + resolve::ConcreteValueAsync + resolve::Field + resolve::FieldAsync - -*/ { fn assert_interface(); } -pub trait Object -/*: OutputType +pub trait Object: OutputType + resolve::TypeName + resolve::ConcreteTypeName + resolve::Value + resolve::ValueAsync + resolve::Field + resolve::FieldAsync - -*/ { fn assert_object(); -} +}*/ pub trait Scalar< 'inp, @@ -52,17 +47,18 @@ pub trait Scalar< fn assert_scalar(); } +/* pub trait Union -/*: OutputType + OutputType + resolve::TypeName + resolve::ConcreteTypeName + resolve::Value + resolve::ValueAsync + resolve::ConcreteValue -+ resolve::ConcreteValueAsync */ ++ resolve::ConcreteValueAsync { fn assert_union(); -} +}*/ pub trait InputType< 'inp, diff --git a/juniper/src/lib.rs b/juniper/src/lib.rs index c612b27a..04ac5d69 100644 --- a/juniper/src/lib.rs +++ b/juniper/src/lib.rs @@ -74,10 +74,7 @@ pub use crate::{ LookAheadSelection, LookAheadValue, OwnedExecutor, Registry, ValuesStream, Variables, }, introspection::IntrospectionFormat, - macros::{ - helper::subscription::{ExtractTypeFromStream, IntoFieldResult}, - input_value as graphql_input_value, value as graphql_value, vars as graphql_vars, - }, + macros::helper::subscription::{ExtractTypeFromStream, IntoFieldResult}, parser::{ParseError, ScalarToken, Spanning}, schema::{ meta, diff --git a/juniper/src/macros/input_value.rs b/juniper/src/macros/graphql_input_value.rs similarity index 99% rename from juniper/src/macros/input_value.rs rename to juniper/src/macros/graphql_input_value.rs index 627b4f63..73233a79 100644 --- a/juniper/src/macros/input_value.rs +++ b/juniper/src/macros/graphql_input_value.rs @@ -83,7 +83,8 @@ /// [`InputValue::Scalar`]: crate::graphql::InputValue::Scalar /// [`InputValue::Variable`]: crate::graphql::InputValue::Variable /// [`Spanning::unlocated`]: crate::Spanning::unlocated -macro_rules! input_value { +#[macro_export] +macro_rules! graphql_input_value { /////////// // Array // /////////// @@ -379,7 +380,7 @@ macro_rules! input_value { } #[doc(inline)] -pub(super) use input_value; +pub use graphql_input_value as input_value; #[cfg(test)] mod tests { diff --git a/juniper/src/macros/value.rs b/juniper/src/macros/graphql_value.rs similarity index 99% rename from juniper/src/macros/value.rs rename to juniper/src/macros/graphql_value.rs index c689afa6..aa72a7fb 100644 --- a/juniper/src/macros/value.rs +++ b/juniper/src/macros/graphql_value.rs @@ -43,7 +43,8 @@ /// /// [`graphql::Value`]: crate::graphql::Value /// [`Value::Object`]: crate::graphql::Value::Object -macro_rules! value { +#[macro_export] +macro_rules! graphql_value { /////////// // Array // /////////// @@ -270,7 +271,7 @@ macro_rules! value { } #[doc(inline)] -pub(super) use value; +pub use graphql_value as value; #[cfg(test)] mod tests { diff --git a/juniper/src/macros/vars.rs b/juniper/src/macros/graphql_vars.rs similarity index 99% rename from juniper/src/macros/vars.rs rename to juniper/src/macros/graphql_vars.rs index d4b75e82..2034e493 100644 --- a/juniper/src/macros/vars.rs +++ b/juniper/src/macros/graphql_vars.rs @@ -24,7 +24,8 @@ /// /// [`graphql::input_value!`]: crate::graphql::input_value /// [`graphql::Variables`]: crate::graphql::Variables -macro_rules! vars { +#[macro_export] +macro_rules! graphql_vars { //////////// // Object // //////////// @@ -196,7 +197,7 @@ macro_rules! vars { } #[doc(inline)] -pub(super) use vars; +pub use graphql_vars as vars; #[cfg(test)] mod tests { diff --git a/juniper/src/macros/mod.rs b/juniper/src/macros/mod.rs index 9e60986e..57f1a4c7 100644 --- a/juniper/src/macros/mod.rs +++ b/juniper/src/macros/mod.rs @@ -6,9 +6,9 @@ pub mod helper; #[macro_use] pub mod reflect; -mod input_value; -mod value; -mod vars; +mod graphql_input_value; +mod graphql_value; +mod graphql_vars; #[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}; diff --git a/juniper/src/macros/reflect.rs b/juniper/src/macros/reflect.rs index e67762df..e7cb1f30 100644 --- a/juniper/src/macros/reflect.rs +++ b/juniper/src/macros/reflect.rs @@ -1,13 +1,16 @@ //! Compile-time reflection of Rust types into GraphQL types. +use std::{rc::Rc, sync::Arc}; + use futures::future::BoxFuture; use crate::{ - reflect::{ - can_be_subtype, fnv1a128, str_eq, str_exists_in_arr, type_len_with_wrapped_val, wrap, - Argument, Arguments, FieldName, Name, Names, Type, Types, WrappedValue, - }, - Arguments as FieldArguments, ExecutionResult, Executor, GraphQLValue, ScalarValue, Nullable, + Arguments as FieldArguments, ExecutionResult, Executor, GraphQLValue, Nullable, ScalarValue, +}; + +pub use crate::reflect::{ + 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`]. diff --git a/juniper/src/reflect/mod.rs b/juniper/src/reflect/mod.rs index 2304e6a2..43d73827 100644 --- a/juniper/src/reflect/mod.rs +++ b/juniper/src/reflect/mod.rs @@ -5,7 +5,7 @@ use crate::behavior; #[doc(inline)] pub use self::macros::{ 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. @@ -329,7 +329,8 @@ mod macros { /// types referencing this interface in the `impl = ...` attribute argument. /// /// Symmetrical to [`assert_interfaces_impls!`]. - macro_rules! assert_implemented_for { + #[macro_export] + macro_rules! reflect_assert_implemented_for { ($behavior: ty, $implementor: ty $(, $interfaces: ty)* $(,)?) => { const _: () = { $({ @@ -356,7 +357,8 @@ mod macros { /// referencing this type in `#[graphql::interface(for = ...)]` attribute. /// /// Symmetrical to [`assert_implemented_for!`]. - macro_rules! assert_interfaces_impls { + #[macro_export] + macro_rules! reflect_assert_interfaces_impls { ($behavior: ty, $interface: ty $(, $implementers: ty)* $(,)?) => { const _: () = { $({ @@ -390,7 +392,8 @@ mod macros { /// [`Field`]: super::Field /// [`Type`]: super::Type /// [0]: https://spec.graphql.org/October2021#IsValidImplementation() - macro_rules! assert_field { + #[macro_export] + macro_rules! reflect_assert_field { ( $base_ty: ty, $impl_ty: ty, @@ -409,7 +412,7 @@ mod macros { /// [`Field`]: super::Field /// [0]: https://spec.graphql.org/October2021#IsValidImplementationFieldType() #[macro_export] - macro_rules! assert_field_type { + macro_rules! reflect_assert_field_type { ( $base_ty: ty, $impl_ty: ty, @@ -492,7 +495,7 @@ mod macros { /// [`Field`]: super::Field /// [0]: https://spec.graphql.org/October2021#sel-IAHZhCHCDEEFAAADHD8Cxob #[macro_export] - macro_rules! assert_field_args { + macro_rules! reflect_assert_field_args { ( $base_ty: ty, $impl_ty: ty, @@ -677,7 +680,8 @@ mod macros { /// /// [`Field`]: super::Field /// [`fnv1a128`]: super::fnv1a128 - macro_rules! assert_has_field { + #[macro_export] + macro_rules! reflect_assert_has_field { ( $field_name: expr, $impl_ty: ty, @@ -703,7 +707,8 @@ mod macros { } /// Concatenates `const` [`str`](prim@str)s in a `const` context. - macro_rules! const_concat { + #[macro_export] + macro_rules! reflect_const_concat { ($($s:expr),* $(,)?) => {{ const LEN: usize = 0 $(+ $s.as_bytes().len())*; const CNT: usize = [$($s),*].len(); @@ -745,7 +750,8 @@ mod macros { /// /// [`Type`]: super::Type /// [`WrappedValue`]: super::WrappedValue - macro_rules! format_type { + #[macro_export] + macro_rules! reflect_format_type { ($ty: expr, $wrapped_value: expr $(,)?) => {{ const TYPE: ($crate::reflect::Type, $crate::reflect::WrappedValue) = ($ty, $wrapped_value); @@ -831,8 +837,12 @@ mod macros { } #[doc(inline)] - pub(super) use { - assert_field, assert_field_args, assert_field_type, assert_has_field, - assert_implemented_for, assert_interfaces_impls, checked_hash, const_concat, format_type, + pub use { + reflect_assert_field as assert_field, reflect_assert_field_args as assert_field_args, + 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, }; } diff --git a/juniper/src/resolve/mod.rs b/juniper/src/resolve/mod.rs index fa32f9e5..21517fc7 100644 --- a/juniper/src/resolve/mod.rs +++ b/juniper/src/resolve/mod.rs @@ -7,8 +7,8 @@ use crate::{ #[doc(inline)] pub use crate::types::{ - arc::TryFromInputValue as InputValueAsArc, r#box::TryFromInputValue as InputValueAsBox, - r#ref::TryFromInputValue as InputValueAsRef, rc::TryFromInputValue as InputValueAsRc, + /*arc::TryFromInputValue as InputValueAsArc,*/ r#box::TryFromInputValue as InputValueAsBox, + /*r#ref::TryFromInputValue as InputValueAsRef, rc::TryFromInputValue as InputValueAsRc,*/ }; pub trait Type { @@ -24,7 +24,7 @@ pub trait TypeName { fn type_name(type_info: &TypeInfo) -> &str; } -pub trait ConcreteTypeName { +pub trait ConcreteTypeName { fn concrete_type_name<'i>(&self, type_info: &'i TypeInfo) -> &'i str; } @@ -74,7 +74,13 @@ pub trait ConcreteValue< ) -> ExecutionResult; } -pub trait ConcreteValueAsync { +pub trait ConcreteValueAsync< + TypeInfo: ?Sized, + Context: ?Sized, + ScalarValue, + Behavior: ?Sized = behavior::Standard, +> +{ fn resolve_concrete_value_async<'r>( &'r self, type_name: &str, @@ -171,7 +177,7 @@ pub trait InputValueOwned: { } -impl InputValueOwned for T where T: for<'i> InputValue<'i, S, B> {} +impl InputValueOwned for T where T: for<'i> InputValue<'i, SV, BH> {} pub trait ScalarToken { fn parse_scalar_token(token: parser::ScalarToken<'_>) -> Result>; diff --git a/juniper/src/schema/meta.rs b/juniper/src/schema/meta.rs index dfcc838d..f9f50af6 100644 --- a/juniper/src/schema/meta.rs +++ b/juniper/src/schema/meta.rs @@ -448,6 +448,7 @@ impl<'a, S> ScalarMeta<'a, S> { } } + /* /// Builds a new [`ScalarMeta`] information with the specified `name`. // TODO: Use `impl Into>` argument once feature // `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::, parse_fn: >::parse_scalar_token, } - } + }*/ /// Sets the `description` of this [`ScalarMeta`] type. /// @@ -837,6 +838,7 @@ where .map_err(T::Error::into_field_error) } +/* fn try_parse_fn_new(v: &InputValue) -> Result<(), FieldError> where T: resolve::InputValueOwned, @@ -854,3 +856,4 @@ where .map(drop) .map_err(T::Error::into_field_error) } +*/ diff --git a/juniper/src/types/arc.rs b/juniper/src/types/arc.rs index 38f0f218..3c6d12d0 100644 --- a/juniper/src/types/arc.rs +++ b/juniper/src/types/arc.rs @@ -10,6 +10,7 @@ use crate::{ IntoFieldError, Registry, Selection, }; +/* impl resolve::Type for Arc where T: resolve::Type + ?Sized, @@ -278,3 +279,4 @@ where { const VALUE: reflect::WrappedValue = T::VALUE; } +*/ diff --git a/juniper/src/types/array.rs b/juniper/src/types/array.rs index 77ef5f9b..f730c39d 100644 --- a/juniper/src/types/array.rs +++ b/juniper/src/types/array.rs @@ -11,6 +11,7 @@ use crate::{ use super::iter; +/* impl resolve::Type for [T; N] where T: resolve::Type, @@ -114,3 +115,4 @@ where { const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE); } +*/ diff --git a/juniper/src/types/box.rs b/juniper/src/types/box.rs index b3093697..68edcc00 100644 --- a/juniper/src/types/box.rs +++ b/juniper/src/types/box.rs @@ -1,278 +1,278 @@ //! GraphQL implementation for [`Box`]. use crate::{ - graphql, + behavior, graphql, meta::MetaType, parser::{ParseError, ScalarToken}, - reflect, resolve, Arguments, BoxFuture, DefaultScalarValue, ExecutionResult, Executor, - IntoFieldError, Registry, Selection, + reflect, resolve, Arguments, BoxFuture, ExecutionResult, Executor, IntoFieldError, Registry, + Selection, }; -impl resolve::Type for Box +impl resolve::Type for Box where - T: resolve::Type + ?Sized, - Info: ?Sized, + T: resolve::Type + ?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 - S: 'r, + SV: 'r, { T::meta(registry, info) } } -impl resolve::TypeName for Box +impl resolve::TypeName for Box where - T: resolve::TypeName + ?Sized, - Info: ?Sized, + T: resolve::TypeName + ?Sized, + TI: ?Sized, + BH: ?Sized, { - fn type_name(info: &Info) -> &str { + fn type_name(info: &TI) -> &str { T::type_name(info) } } -impl resolve::ConcreteTypeName for Box +impl resolve::ConcreteTypeName for Box where - T: resolve::ConcreteTypeName + ?Sized, - Info: ?Sized, + T: resolve::ConcreteTypeName + ?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) } } -impl resolve::Value for Box +impl resolve::Value for Box where - T: resolve::Value + ?Sized, - Info: ?Sized, - Ctx: ?Sized, + T: resolve::Value + ?Sized, + TI: ?Sized, + CX: ?Sized, + BH: ?Sized, { fn resolve_value( &self, - selection_set: Option<&[Selection<'_, S>]>, - info: &Info, - executor: &Executor, - ) -> ExecutionResult { - (**self).resolve_value(selection_set, info, executor) + selection_set: Option<&[Selection<'_, SV>]>, + type_info: &TI, + executor: &Executor, + ) -> ExecutionResult { + (**self).resolve_value(selection_set, type_info, executor) } } -impl resolve::ValueAsync for Box +impl resolve::ValueAsync for Box where - T: resolve::ValueAsync + ?Sized, - Info: ?Sized, - Ctx: ?Sized, + T: resolve::ValueAsync + ?Sized, + TI: ?Sized, + CX: ?Sized, + BH: ?Sized, { fn resolve_value_async<'r>( &'r self, - selection_set: Option<&'r [Selection<'_, S>]>, - info: &'r Info, - executor: &'r Executor, - ) -> BoxFuture<'r, ExecutionResult> { - (**self).resolve_value_async(selection_set, info, executor) + selection_set: Option<&'r [Selection<'_, SV>]>, + type_info: &'r TI, + executor: &'r Executor, + ) -> BoxFuture<'r, ExecutionResult> { + (**self).resolve_value_async(selection_set, type_info, executor) } } -impl resolve::ConcreteValue for Box +impl resolve::ConcreteValue for Box where - T: resolve::ConcreteValue + ?Sized, - Info: ?Sized, - Ctx: ?Sized, + T: resolve::ConcreteValue + ?Sized, + TI: ?Sized, + CX: ?Sized, + BH: ?Sized, { fn resolve_concrete_value( &self, type_name: &str, - selection_set: Option<&[Selection<'_, S>]>, - info: &Info, - executor: &Executor, - ) -> ExecutionResult { - (**self).resolve_concrete_value(type_name, selection_set, info, executor) + selection_set: Option<&[Selection<'_, SV>]>, + type_info: &TI, + executor: &Executor, + ) -> ExecutionResult { + (**self).resolve_concrete_value(type_name, selection_set, type_info, executor) } } -impl resolve::ConcreteValueAsync for Box +impl resolve::ConcreteValueAsync for Box where - T: resolve::ConcreteValueAsync + ?Sized, - Info: ?Sized, - Ctx: ?Sized, + T: resolve::ConcreteValueAsync + ?Sized, + TI: ?Sized, + CX: ?Sized, + BH: ?Sized, { fn resolve_concrete_value_async<'r>( &'r self, type_name: &str, - selection_set: Option<&'r [Selection<'_, S>]>, - info: &'r Info, - executor: &'r Executor, - ) -> BoxFuture<'r, ExecutionResult> { - (**self).resolve_concrete_value_async(type_name, selection_set, info, executor) + selection_set: Option<&'r [Selection<'_, SV>]>, + type_info: &'r TI, + executor: &'r Executor, + ) -> BoxFuture<'r, ExecutionResult> { + (**self).resolve_concrete_value_async(type_name, selection_set, type_info, executor) } } -impl resolve::Field for Box +impl resolve::Field for Box where - T: resolve::Field + ?Sized, - Info: ?Sized, - Ctx: ?Sized, + T: resolve::Field + ?Sized, + TI: ?Sized, + CX: ?Sized, + BH: ?Sized, { fn resolve_field( &self, field_name: &str, - arguments: &Arguments, - info: &Info, - executor: &Executor, - ) -> ExecutionResult { - (**self).resolve_field(field_name, arguments, info, executor) + arguments: &Arguments, + type_info: &TI, + executor: &Executor, + ) -> ExecutionResult { + (**self).resolve_field(field_name, arguments, type_info, executor) } } -impl resolve::FieldAsync for Box +impl resolve::FieldAsync for Box where - T: resolve::FieldAsync + ?Sized, - Info: ?Sized, - Ctx: ?Sized, + T: resolve::FieldAsync + ?Sized, + TI: ?Sized, + CX: ?Sized, + BH: ?Sized, { fn resolve_field_async<'r>( &'r self, field_name: &'r str, - arguments: &'r Arguments, - info: &'r Info, - executor: &'r Executor, - ) -> BoxFuture<'r, ExecutionResult> { - (**self).resolve_field_async(field_name, arguments, info, executor) + arguments: &'r Arguments, + type_info: &'r TI, + executor: &'r Executor, + ) -> BoxFuture<'r, ExecutionResult> { + (**self).resolve_field_async(field_name, arguments, type_info, executor) } } -impl resolve::ToInputValue for Box +impl resolve::ToInputValue for Box where - T: resolve::ToInputValue + ?Sized, + T: resolve::ToInputValue + ?Sized, + BH: ?Sized, { - fn to_input_value(&self) -> graphql::InputValue { + fn to_input_value(&self) -> graphql::InputValue { (**self).to_input_value() } } -impl<'inp, T, S> resolve::InputValue<'inp, S> for Box +impl<'i, T, SV, BH> resolve::InputValue<'i, SV, BH> for Box where - T: resolve::InputValueAsBox<'inp, S> + ?Sized, - S: 'inp, + T: resolve::InputValueAsBox<'i, SV, BH> + ?Sized, + SV: 'i, + BH: ?Sized, { - type Error = >::Error; + type Error = T::Error; - fn try_from_input_value(v: &'inp graphql::InputValue) -> Result { - >::try_from_input_value(v) + fn try_from_input_value(v: &'i graphql::InputValue) -> Result { + T::try_from_input_value(v) } fn try_from_implicit_null() -> Result { - >::try_from_implicit_null() + T::try_from_implicit_null() } } -pub trait TryFromInputValue<'input, S: 'input = DefaultScalarValue> { - type Error: IntoFieldError; +pub trait TryFromInputValue<'input, ScalarValue: 'input, Behavior: ?Sized = behavior::Standard> { + type Error: IntoFieldError; - fn try_from_input_value(v: &'input graphql::InputValue) -> Result, Self::Error>; + fn try_from_input_value( + v: &'input graphql::InputValue, + ) -> Result, Self::Error>; fn try_from_implicit_null() -> Result, Self::Error> { - Self::try_from_input_value(&graphql::InputValue::::Null) + Self::try_from_input_value(&graphql::InputValue::::Null) } } -impl<'inp, T, S> TryFromInputValue<'inp, S> for T +impl<'i, T, SV, BH> TryFromInputValue<'i, SV, BH> for T where - T: resolve::InputValue<'inp, S>, - S: 'inp, + T: resolve::InputValue<'i, SV, BH>, + SV: 'i, + BH: ?Sized, { - type Error = >::Error; + type Error = T::Error; - fn try_from_input_value(v: &'inp graphql::InputValue) -> Result, Self::Error> { - >::try_from_input_value(v).map(Box::new) + fn try_from_input_value(v: &'i graphql::InputValue) -> Result, Self::Error> { + T::try_from_input_value(v).map(Box::new) } fn try_from_implicit_null() -> Result, Self::Error> { - >::try_from_implicit_null().map(Box::new) + T::try_from_implicit_null().map(Box::new) } } -impl resolve::ScalarToken for Box +impl resolve::ScalarToken for Box where - T: resolve::ScalarToken + ?Sized, + T: resolve::ScalarToken + ?Sized, + BH: ?Sized, { - fn parse_scalar_token(token: ScalarToken<'_>) -> Result> { + fn parse_scalar_token(token: ScalarToken<'_>) -> Result> { T::parse_scalar_token(token) } } -impl<'i, T, Info, S: 'i> graphql::InputType<'i, Info, S> for Box +impl<'i, T, TI, SV, BH> graphql::InputType<'i, TI, SV, BH> for Box where - T: graphql::InputType<'i, Info, S> + resolve::InputValueAsBox<'i, S> + ?Sized, - Info: ?Sized, + T: graphql::InputType<'i, TI, SV, BH>, + TI: ?Sized, + SV: 'i, + BH: ?Sized, { fn assert_input_type() { T::assert_input_type() } } -impl graphql::OutputType for Box +impl graphql::OutputType for Box where - T: graphql::OutputType + ?Sized, + T: graphql::OutputType + ?Sized, + TI: ?Sized, + CX: ?Sized, + BH: ?Sized, { fn assert_output_type() { T::assert_output_type() } } -impl graphql::Interface for Box +impl<'i, T, TI, CX, SV, BH> graphql::Scalar<'i, TI, CX, SV, BH> for Box where - T: graphql::Interface + ?Sized, -{ - fn assert_interface() { - T::assert_interface() - } -} - -impl graphql::Object for Box -where - T: graphql::Object + ?Sized, -{ - fn assert_object() { - T::assert_object() - } -} - -impl graphql::Scalar for Box -where - T: graphql::Scalar + ?Sized, + T: graphql::Scalar<'i, TI, CX, SV, BH>, + TI: ?Sized, + CX: ?Sized, + SV: 'i, + BH: ?Sized, { fn assert_scalar() { T::assert_scalar() } } -impl graphql::Union for Box +impl reflect::BaseType for Box where - T: graphql::Union + ?Sized, -{ - fn assert_union() { - T::assert_union() - } -} - -impl reflect::BaseType for Box -where - T: reflect::BaseType + ?Sized, + T: reflect::BaseType + ?Sized, + BH: ?Sized, { const NAME: reflect::Type = T::NAME; } -impl reflect::BaseSubTypes for Box +impl reflect::BaseSubTypes for Box where - T: reflect::BaseSubTypes + ?Sized, + T: reflect::BaseSubTypes + ?Sized, + BH: ?Sized, { const NAMES: reflect::Types = T::NAMES; } -impl reflect::WrappedType for Box +impl reflect::WrappedType for Box where - T: reflect::WrappedType + ?Sized, + T: reflect::WrappedType + ?Sized, + BH: ?Sized, { const VALUE: reflect::WrappedValue = T::VALUE; } diff --git a/juniper/src/types/iter.rs b/juniper/src/types/iter.rs index c3979b08..8d6aad9d 100644 --- a/juniper/src/types/iter.rs +++ b/juniper/src/types/iter.rs @@ -2,6 +2,7 @@ use crate::{graphql, resolve, ExecutionResult, Executor, Selection}; +/* pub fn resolve_list<'t, T, S, Info, Ctx, I>( iter: I, selection_set: Option<&[Selection<'_, S>]>, @@ -65,3 +66,4 @@ where } Ok(graphql::Value::list(values)) } +*/ diff --git a/juniper/src/types/nullable.rs b/juniper/src/types/nullable.rs index daec6044..b48064df 100644 --- a/juniper/src/types/nullable.rs +++ b/juniper/src/types/nullable.rs @@ -272,6 +272,7 @@ impl Nullable<&mut T> { } } +/* impl resolve::Type for Nullable where T: resolve::Type, @@ -395,6 +396,7 @@ where const VALUE: reflect::WrappedValue = reflect::wrap::nullable(T::VALUE); } + */ //////////////////////////////////////////////////////////////////////////////// impl GraphQLType for Nullable diff --git a/juniper/src/types/option.rs b/juniper/src/types/option.rs index 0d8ebb6a..7f3ef70d 100644 --- a/juniper/src/types/option.rs +++ b/juniper/src/types/option.rs @@ -8,7 +8,7 @@ use crate::{ schema::meta::MetaType, BoxFuture, Selection, }; - +/* impl resolve::Type for Option where T: resolve::Type, @@ -127,3 +127,4 @@ where { const VALUE: reflect::WrappedValue = reflect::wrap::nullable(T::VALUE); } +*/ diff --git a/juniper/src/types/rc.rs b/juniper/src/types/rc.rs index ebecc3f2..88f7089d 100644 --- a/juniper/src/types/rc.rs +++ b/juniper/src/types/rc.rs @@ -10,6 +10,7 @@ use crate::{ IntoFieldError, Registry, Selection, }; +/* impl resolve::Type for Rc where T: resolve::Type + ?Sized, @@ -278,3 +279,4 @@ where { const VALUE: reflect::WrappedValue = T::VALUE; } +*/ diff --git a/juniper/src/types/ref.rs b/juniper/src/types/ref.rs index 5b84d54f..e087482a 100644 --- a/juniper/src/types/ref.rs +++ b/juniper/src/types/ref.rs @@ -10,6 +10,7 @@ use crate::{ IntoFieldError, Registry, Selection, }; +/* impl<'me, T, Info, S> resolve::Type for &'me T where T: resolve::Type + ?Sized, @@ -265,3 +266,4 @@ where { const VALUE: reflect::WrappedValue = T::VALUE; } +*/ diff --git a/juniper/src/types/ref_mut.rs b/juniper/src/types/ref_mut.rs index 77f8b602..31a57211 100644 --- a/juniper/src/types/ref_mut.rs +++ b/juniper/src/types/ref_mut.rs @@ -9,6 +9,7 @@ use crate::{ reflect, resolve, Arguments, BoxFuture, ExecutionResult, Executor, Registry, Selection, }; +/* impl<'me, T, Info, S> resolve::Type for &'me mut T where T: resolve::Type + ?Sized, @@ -225,3 +226,4 @@ where { const VALUE: reflect::WrappedValue = T::VALUE; } +*/ diff --git a/juniper/src/types/result.rs b/juniper/src/types/result.rs index 1077f979..51ec79ad 100644 --- a/juniper/src/types/result.rs +++ b/juniper/src/types/result.rs @@ -2,6 +2,7 @@ use crate::reflect; +/* impl reflect::BaseType for Result where T: reflect::BaseType, @@ -22,3 +23,4 @@ where { const VALUE: reflect::WrappedValue = T::VALUE; } +*/ diff --git a/juniper/src/types/slice.rs b/juniper/src/types/slice.rs index 022a335b..0b31c7a9 100644 --- a/juniper/src/types/slice.rs +++ b/juniper/src/types/slice.rs @@ -11,6 +11,7 @@ use crate::{ use super::iter; +/* impl resolve::Type for [T] where T: resolve::Type, @@ -71,7 +72,6 @@ where } } -/* impl graphql::InputType for [T] where T: graphql::InputType, @@ -80,7 +80,7 @@ where T::assert_input_type() } } -*/ + impl graphql::OutputType for [T] where @@ -111,3 +111,4 @@ where { const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE); } +*/ diff --git a/juniper/src/types/str.rs b/juniper/src/types/str.rs index c1a559a0..a5ff4436 100644 --- a/juniper/src/types/str.rs +++ b/juniper/src/types/str.rs @@ -13,6 +13,7 @@ use crate::{ reflect, resolve, BoxFuture, ExecutionResult, Executor, Registry, ScalarValue, Selection, }; +/* impl resolve::Type for str { fn meta<'r>(registry: &mut Registry<'r, S>, info: &Info) -> MetaType<'r, S> where @@ -146,3 +147,4 @@ impl reflect::BaseSubTypes for str { impl reflect::WrappedType for str { const VALUE: reflect::WrappedValue = reflect::wrap::SINGULAR; } +*/ diff --git a/juniper/src/types/vec.rs b/juniper/src/types/vec.rs index a3022e41..ad4cd8ed 100644 --- a/juniper/src/types/vec.rs +++ b/juniper/src/types/vec.rs @@ -9,6 +9,7 @@ use crate::{ use super::iter; +/* impl resolve::Type for Vec where T: resolve::Type, @@ -69,7 +70,7 @@ where } } -/* + impl<'i, T, Info, S> graphql::InputType<'i, Info, S> for Vec where T: graphql::InputType<'i, Info, S>, @@ -79,7 +80,7 @@ where T::assert_input_type() } } - */ + impl graphql::OutputType for Vec where @@ -110,3 +111,4 @@ where { const VALUE: reflect::WrappedValue = reflect::wrap::list(T::VALUE); } +*/