Provide access to juniper::GraphQLBatchRequest from juniper_rocket::GraphQLRequest via AsRef/AsMut (#968, #930)

This commit is contained in:
Kai Ren 2021-07-21 17:33:11 +03:00 committed by GitHub
parent 5fbd751de2
commit 64fb83f5aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -1,6 +1,7 @@
# master # master
- Compatibility with the latest `juniper`. - 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) # [[0.8.0] 2021-07-08](https://github.com/graphql-rust/juniper/releases/tag/juniper_rocket-0.8.0)

View file

@ -65,6 +65,18 @@ pub struct GraphQLRequest<S = DefaultScalarValue>(GraphQLBatchRequest<S>)
where where
S: ScalarValue; S: ScalarValue;
impl<S: ScalarValue> AsRef<GraphQLBatchRequest<S>> for GraphQLRequest<S> {
fn as_ref(&self) -> &GraphQLBatchRequest<S> {
&self.0
}
}
impl<S: ScalarValue> AsMut<GraphQLBatchRequest<S>> for GraphQLRequest<S> {
fn as_mut(&mut self) -> &mut GraphQLBatchRequest<S> {
&mut self.0
}
}
/// Simple wrapper around the result of executing a GraphQL query /// Simple wrapper around the result of executing a GraphQL query
pub struct GraphQLResponse(pub Status, pub String); pub struct GraphQLResponse(pub Status, pub String);