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()))
}
/*
/// 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, _>(T::type_name(info).to_owned())
}
}*/
/// Creates a [`ListMeta`] type.
///

View file

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

View file

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

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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};

View file

@ -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`].

View file

@ -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,
};
}

View file

@ -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<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;
}
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;
}
@ -74,7 +74,13 @@ pub trait ConcreteValue<
) -> 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>(
&'r self,
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> {
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`.
// TODO: Use `impl Into<Cow<'a, str>>` 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::<S, T>,
parse_fn: <T as resolve::ScalarToken<S>>::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<S, T>(v: &InputValue<S>) -> Result<(), FieldError<S>>
where
T: resolve::InputValueOwned<S>,
@ -854,3 +856,4 @@ where
.map(drop)
.map_err(T::Error::into_field_error)
}
*/

View file

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

View file

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

View file

@ -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<T, Info, S> resolve::Type<Info, S> for Box<T>
impl<T, TI, SV, BH> resolve::Type<TI, SV, BH> for Box<T>
where
T: resolve::Type<Info, S> + ?Sized,
Info: ?Sized,
T: resolve::Type<TI, SV, BH> + ?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<T, Info> resolve::TypeName<Info> for Box<T>
impl<T, TI, BH> resolve::TypeName<TI, BH> for Box<T>
where
T: resolve::TypeName<Info> + ?Sized,
Info: ?Sized,
T: resolve::TypeName<TI, BH> + ?Sized,
TI: ?Sized,
BH: ?Sized,
{
fn type_name(info: &Info) -> &str {
fn type_name(info: &TI) -> &str {
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
T: resolve::ConcreteTypeName<Info> + ?Sized,
Info: ?Sized,
T: resolve::ConcreteTypeName<TI, BH> + ?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<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
T: resolve::Value<Info, Ctx, S> + ?Sized,
Info: ?Sized,
Ctx: ?Sized,
T: resolve::Value<TI, CX, SV, BH> + ?Sized,
TI: ?Sized,
CX: ?Sized,
BH: ?Sized,
{
fn resolve_value(
&self,
selection_set: Option<&[Selection<'_, S>]>,
info: &Info,
executor: &Executor<Ctx, S>,
) -> ExecutionResult<S> {
(**self).resolve_value(selection_set, info, executor)
selection_set: Option<&[Selection<'_, SV>]>,
type_info: &TI,
executor: &Executor<CX, SV>,
) -> ExecutionResult<SV> {
(**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
T: resolve::ValueAsync<Info, Ctx, S> + ?Sized,
Info: ?Sized,
Ctx: ?Sized,
T: resolve::ValueAsync<TI, CX, SV, BH> + ?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<Ctx, S>,
) -> BoxFuture<'r, ExecutionResult<S>> {
(**self).resolve_value_async(selection_set, info, executor)
selection_set: Option<&'r [Selection<'_, SV>]>,
type_info: &'r TI,
executor: &'r Executor<CX, SV>,
) -> BoxFuture<'r, ExecutionResult<SV>> {
(**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
T: resolve::ConcreteValue<Info, Ctx, S> + ?Sized,
Info: ?Sized,
Ctx: ?Sized,
T: resolve::ConcreteValue<TI, CX, SV, BH> + ?Sized,
TI: ?Sized,
CX: ?Sized,
BH: ?Sized,
{
fn resolve_concrete_value(
&self,
type_name: &str,
selection_set: Option<&[Selection<'_, S>]>,
info: &Info,
executor: &Executor<Ctx, S>,
) -> ExecutionResult<S> {
(**self).resolve_concrete_value(type_name, selection_set, info, executor)
selection_set: Option<&[Selection<'_, SV>]>,
type_info: &TI,
executor: &Executor<CX, SV>,
) -> ExecutionResult<SV> {
(**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
T: resolve::ConcreteValueAsync<Info, Ctx, S> + ?Sized,
Info: ?Sized,
Ctx: ?Sized,
T: resolve::ConcreteValueAsync<TI, CX, SV, BH> + ?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<Ctx, S>,
) -> BoxFuture<'r, ExecutionResult<S>> {
(**self).resolve_concrete_value_async(type_name, selection_set, info, executor)
selection_set: Option<&'r [Selection<'_, SV>]>,
type_info: &'r TI,
executor: &'r Executor<CX, SV>,
) -> BoxFuture<'r, ExecutionResult<SV>> {
(**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
T: resolve::Field<Info, Ctx, S> + ?Sized,
Info: ?Sized,
Ctx: ?Sized,
T: resolve::Field<TI, CX, SV, BH> + ?Sized,
TI: ?Sized,
CX: ?Sized,
BH: ?Sized,
{
fn resolve_field(
&self,
field_name: &str,
arguments: &Arguments<S>,
info: &Info,
executor: &Executor<Ctx, S>,
) -> ExecutionResult<S> {
(**self).resolve_field(field_name, arguments, info, executor)
arguments: &Arguments<SV>,
type_info: &TI,
executor: &Executor<CX, SV>,
) -> ExecutionResult<SV> {
(**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
T: resolve::FieldAsync<Info, Ctx, S> + ?Sized,
Info: ?Sized,
Ctx: ?Sized,
T: resolve::FieldAsync<TI, CX, SV, BH> + ?Sized,
TI: ?Sized,
CX: ?Sized,
BH: ?Sized,
{
fn resolve_field_async<'r>(
&'r self,
field_name: &'r str,
arguments: &'r Arguments<S>,
info: &'r Info,
executor: &'r Executor<Ctx, S>,
) -> BoxFuture<'r, ExecutionResult<S>> {
(**self).resolve_field_async(field_name, arguments, info, executor)
arguments: &'r Arguments<SV>,
type_info: &'r TI,
executor: &'r Executor<CX, SV>,
) -> BoxFuture<'r, ExecutionResult<SV>> {
(**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
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()
}
}
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
T: resolve::InputValueAsBox<'inp, S> + ?Sized,
S: 'inp,
T: resolve::InputValueAsBox<'i, SV, BH> + ?Sized,
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> {
<T as resolve::InputValueAsBox<'inp, S>>::try_from_input_value(v)
fn try_from_input_value(v: &'i graphql::InputValue<SV>) -> Result<Self, Self::Error> {
T::try_from_input_value(v)
}
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> {
type Error: IntoFieldError<S>;
pub trait TryFromInputValue<'input, ScalarValue: 'input, Behavior: ?Sized = behavior::Standard> {
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> {
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
T: resolve::InputValue<'inp, S>,
S: 'inp,
T: resolve::InputValue<'i, SV, BH>,
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> {
<T as resolve::InputValue<'inp, S>>::try_from_input_value(v).map(Box::new)
fn try_from_input_value(v: &'i graphql::InputValue<SV>) -> Result<Box<Self>, Self::Error> {
T::try_from_input_value(v).map(Box::new)
}
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
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)
}
}
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
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<T, S> graphql::OutputType<S> for Box<T>
impl<T, TI, CX, SV, BH> graphql::OutputType<TI, CX, SV, BH> for Box<T>
where
T: graphql::OutputType<S> + ?Sized,
T: graphql::OutputType<TI, CX, SV, BH> + ?Sized,
TI: ?Sized,
CX: ?Sized,
BH: ?Sized,
{
fn 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
T: graphql::Interface<S> + ?Sized,
{
fn assert_interface() {
T::assert_interface()
}
}
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,
T: graphql::Scalar<'i, TI, CX, SV, BH>,
TI: ?Sized,
CX: ?Sized,
SV: 'i,
BH: ?Sized,
{
fn assert_scalar() {
T::assert_scalar()
}
}
impl<T, S> graphql::Union<S> for Box<T>
impl<T, BH> reflect::BaseType<BH> for Box<T>
where
T: graphql::Union<S> + ?Sized,
{
fn assert_union() {
T::assert_union()
}
}
impl<T, S> reflect::BaseType<S> for Box<T>
where
T: reflect::BaseType<S> + ?Sized,
T: reflect::BaseType<BH> + ?Sized,
BH: ?Sized,
{
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
T: reflect::BaseSubTypes<S> + ?Sized,
T: reflect::BaseSubTypes<BH> + ?Sized,
BH: ?Sized,
{
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
T: reflect::WrappedType<S> + ?Sized,
T: reflect::WrappedType<BH> + ?Sized,
BH: ?Sized,
{
const VALUE: reflect::WrappedValue = T::VALUE;
}

View file

@ -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))
}
*/

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,6 +11,7 @@ use crate::{
use super::iter;
/*
impl<T, Info, S> resolve::Type<Info, S> for [T]
where
T: resolve::Type<Info, S>,
@ -71,7 +72,6 @@ where
}
}
/*
impl<T, S> graphql::InputType<S> for [T]
where
T: graphql::InputType<S>,
@ -80,7 +80,7 @@ where
T::assert_input_type()
}
}
*/
impl<T, S> graphql::OutputType<S> for [T]
where
@ -111,3 +111,4 @@ where
{
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,
};
/*
impl<Info: ?Sized, S: ScalarValue> resolve::Type<Info, S> for str {
fn meta<'r>(registry: &mut Registry<'r, S>, info: &Info) -> MetaType<'r, S>
where
@ -146,3 +147,4 @@ impl<S> reflect::BaseSubTypes<S> for str {
impl<S> reflect::WrappedType<S> for str {
const VALUE: reflect::WrappedValue = reflect::wrap::SINGULAR;
}
*/

View file

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