File tree 2 files changed +16
-6
lines changed
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
43
43
- ` jiff::tz::TimeZone ` as ` TimeZoneOrUtcOffset ` and ` TimeZone ` scalars.
44
44
- ` jiff::tz::Offset ` as ` UtcOffset ` scalar.
45
45
- ` jiff::Span ` as ` Duration ` scalar.
46
+ - ` http::GraphQLResponse::into_result() ` method. ([ #1293 ] )
46
47
47
48
### Changed
48
49
@@ -62,6 +63,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
62
63
[ #1281 ] : /../../pull/1281
63
64
[ #1284 ] : /../../pull/1284
64
65
[ #1287 ] : /../../issues/1287
66
+ [ #1293 ] : /../../pull/1293
65
67
[ #1311 ] : /../../pull/1311
66
68
[ #1316 ] : /../../pull/1316
67
69
[ #1318 ] : /../../pull/1318
Original file line number Diff line number Diff line change @@ -171,20 +171,28 @@ impl<S> GraphQLResponse<S>
171
171
where
172
172
S : ScalarValue ,
173
173
{
174
- /// Constructs new `GraphQLResponse` using the given result
174
+ /// Constructs a new [`GraphQLResponse`] from the provided execution [`Result`].
175
+ #[ must_use]
175
176
pub fn from_result ( r : Result < ( Value < S > , Vec < ExecutionError < S > > ) , GraphQLError > ) -> Self {
176
177
Self ( r)
177
178
}
178
179
179
- /// Constructs an error response outside of the normal execution flow
180
+ /// Unwraps this [`GraphQLResponse`] into its underlying execution [`Result`].
181
+ pub fn into_result ( self ) -> Result < ( Value < S > , Vec < ExecutionError < S > > ) , GraphQLError > {
182
+ self . 0
183
+ }
184
+
185
+ /// Constructs an error [`GraphQLResponse`] outside the normal execution flow.
186
+ #[ must_use]
180
187
pub fn error ( error : FieldError < S > ) -> Self {
181
- GraphQLResponse ( Ok ( ( Value :: null ( ) , vec ! [ ExecutionError :: at_origin( error) ] ) ) )
188
+ Self ( Ok ( ( Value :: null ( ) , vec ! [ ExecutionError :: at_origin( error) ] ) ) )
182
189
}
183
190
184
- /// Was the request successful or not?
191
+ /// Indicates whether this [`GraphQLResponse`] contains a successful execution [`Result`].
185
192
///
186
- /// Note that there still might be errors in the response even though it's
187
- /// considered OK. This is by design in GraphQL.
193
+ /// **NOTE**: There still might be errors in the response even though it's considered OK.
194
+ /// This is by design in GraphQL.
195
+ #[ must_use]
188
196
pub fn is_ok ( & self ) -> bool {
189
197
self . 0 . is_ok ( )
190
198
}
You can’t perform that action at this time.
0 commit comments