From e3577250ebf82e3bccbd54405029cfb2c53501fb Mon Sep 17 00:00:00 2001 From: Sunli Date: Fri, 29 May 2020 12:42:58 +0800 Subject: [PATCH] Remove premature generic constraints of DataSource type. --- src/types/connection/mod.rs | 8 ++++---- src/types/connection/slice.rs | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/types/connection/mod.rs b/src/types/connection/mod.rs index 01f6cb37..6f3d71aa 100644 --- a/src/types/connection/mod.rs +++ b/src/types/connection/mod.rs @@ -6,7 +6,7 @@ mod edge; mod page_info; mod slice; -use crate::{Context, FieldResult, ObjectType, OutputValueType}; +use crate::{Context, FieldResult}; pub use connection_type::Connection; pub use cursor::CursorType; pub use edge::Edge; @@ -115,19 +115,19 @@ pub trait DataSource { type CursorType: CursorType + Send + Sync; /// Record type - type NodeType: OutputValueType + Send; + type NodeType; /// Additional fields for connection /// /// Is a type that implements `ObjectType` and can be defined by the procedure macro `#[Object]` or `#[SimpleObject]`. /// - type ConnectionFieldsType: ObjectType + Send; + type ConnectionFieldsType; /// Additional fields for edge /// /// Is a type that implements `ObjectType` and can be defined by the procedure macro `#[Object]` or `#[SimpleObject]`. /// - type EdgeFieldsType: ObjectType + Send; + type EdgeFieldsType; /// Parses the parameters and executes the query. async fn query( diff --git a/src/types/connection/slice.rs b/src/types/connection/slice.rs index 92178b1d..fa313eb5 100644 --- a/src/types/connection/slice.rs +++ b/src/types/connection/slice.rs @@ -1,12 +1,9 @@ use crate::connection::{Connection, DataSource, Edge, EmptyFields}; -use crate::{Context, FieldResult, OutputValueType}; +use crate::{Context, FieldResult}; use async_graphql_derive::DataSource; #[DataSource(internal)] -impl<'a, T> DataSource for &'a [T] -where - T: OutputValueType + Send + Sync + 'a, -{ +impl<'a, T: Send + Sync> DataSource for &'a [T] { type CursorType = usize; type NodeType = &'a T; type ConnectionFieldsType = EmptyFields;