Ignore InnerT when implementing Send/Sync for RootNode (unsafe)

This commit is contained in:
Magnus Hallin 2016-11-30 20:57:18 +01:00
parent e5167e1aae
commit ca3832c6c2

View file

@ -21,6 +21,17 @@ pub struct RootNode<InnerT, QueryT, MutationT=()> {
phantom_wrapped: PhantomData<InnerT>,
}
// 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<InnerT, QueryT, MutationT> Send for RootNode<InnerT, QueryT, MutationT>
where QueryT: Send, MutationT: Send, SchemaType: Send { }
unsafe impl<InnerT, QueryT, MutationT> Sync for RootNode<InnerT, QueryT, MutationT>
where QueryT: Sync, MutationT: Sync, SchemaType: Sync { }
/// Metadata for a schema
pub struct SchemaType {
types: HashMap<String, MetaType>,