From 64fb83f5aa865962527cf4ff691ef277f7147b84 Mon Sep 17 00:00:00 2001 From: Kai Ren Date: Wed, 21 Jul 2021 17:33:11 +0300 Subject: [PATCH] Provide access to juniper::GraphQLBatchRequest from juniper_rocket::GraphQLRequest via AsRef/AsMut (#968, #930) --- juniper_rocket/CHANGELOG.md | 1 + juniper_rocket/src/lib.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/juniper_rocket/CHANGELOG.md b/juniper_rocket/CHANGELOG.md index 7f0e099d..9d047ea4 100644 --- a/juniper_rocket/CHANGELOG.md +++ b/juniper_rocket/CHANGELOG.md @@ -1,6 +1,7 @@ # master - Compatibility with the latest `juniper`. +- Provide `AsRef` and `AsMut` implementation for `GraphQLRequest` to its inner type ([#968](https://github.com/graphql-rust/juniper/pull/968), [#930](https://github.com/graphql-rust/juniper/issues/930)). # [[0.8.0] 2021-07-08](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-0.8.0) diff --git a/juniper_rocket/src/lib.rs b/juniper_rocket/src/lib.rs index 2ab7898d..9d644c9f 100644 --- a/juniper_rocket/src/lib.rs +++ b/juniper_rocket/src/lib.rs @@ -65,6 +65,18 @@ pub struct GraphQLRequest(GraphQLBatchRequest) where S: ScalarValue; +impl AsRef> for GraphQLRequest { + fn as_ref(&self) -> &GraphQLBatchRequest { + &self.0 + } +} + +impl AsMut> for GraphQLRequest { + fn as_mut(&mut self) -> &mut GraphQLBatchRequest { + &mut self.0 + } +} + /// Simple wrapper around the result of executing a GraphQL query pub struct GraphQLResponse(pub Status, pub String);