Skip to content

Commit 64fb83f

Browse files
authored
Provide access to juniper::GraphQLBatchRequest from juniper_rocket::GraphQLRequest via AsRef/AsMut (#968, #930)
1 parent 5fbd751 commit 64fb83f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

juniper_rocket/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# master
22

33
- Compatibility with the latest `juniper`.
4+
- 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)).
45

56
# [[0.8.0] 2021-07-08](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-0.8.0)
67

juniper_rocket/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ pub struct GraphQLRequest<S = DefaultScalarValue>(GraphQLBatchRequest<S>)
6565
where
6666
S: ScalarValue;
6767

68+
impl<S: ScalarValue> AsRef<GraphQLBatchRequest<S>> for GraphQLRequest<S> {
69+
fn as_ref(&self) -> &GraphQLBatchRequest<S> {
70+
&self.0
71+
}
72+
}
73+
74+
impl<S: ScalarValue> AsMut<GraphQLBatchRequest<S>> for GraphQLRequest<S> {
75+
fn as_mut(&mut self) -> &mut GraphQLBatchRequest<S> {
76+
&mut self.0
77+
}
78+
}
79+
6880
/// Simple wrapper around the result of executing a GraphQL query
6981
pub struct GraphQLResponse(pub Status, pub String);
7082

0 commit comments

Comments
 (0)