From ca3832c6c28da29cd5a59954ab74f340b24e8106 Mon Sep 17 00:00:00 2001 From: Magnus Hallin Date: Wed, 30 Nov 2016 20:57:18 +0100 Subject: [PATCH] Ignore InnerT when implementing Send/Sync for RootNode (unsafe) --- src/schema/model.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/schema/model.rs b/src/schema/model.rs index f1810a35..8836b638 100644 --- a/src/schema/model.rs +++ b/src/schema/model.rs @@ -21,6 +21,17 @@ pub struct RootNode { phantom_wrapped: PhantomData, } +// RootNode implements Send + Sync if both the mutation type and query +// type implements them. SchemaType also needs to implement them. +// +// InnerT does _not_ need to implement Send + Sync because it does not +// actually appear in the struct. +unsafe impl Send for RootNode + where QueryT: Send, MutationT: Send, SchemaType: Send { } + +unsafe impl Sync for RootNode + where QueryT: Sync, MutationT: Sync, SchemaType: Sync { } + /// Metadata for a schema pub struct SchemaType { types: HashMap,