pub struct GraphQLResponse<S = DefaultScalarValue>(/* private fields */);
Expand description
Simple wrapper around the result from executing a GraphQL query
This struct implements Serialize, so you can simply serialize this
to JSON and send it over the wire. Use the is_ok
method to determine
whether to send a 200 or 400 HTTP status code.
Implementations§
Source§impl<S> GraphQLResponse<S>where
S: ScalarValue,
impl<S> GraphQLResponse<S>where
S: ScalarValue,
Sourcepub fn from_result(
r: Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError>,
) -> Self
pub fn from_result( r: Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError>, ) -> Self
Constructs new GraphQLResponse
using the given result
Sourcepub fn error(error: FieldError<S>) -> Self
pub fn error(error: FieldError<S>) -> Self
Constructs an error response outside of the normal execution flow
Trait Implementations§
Source§impl<S: Clone> Clone for GraphQLResponse<S>
impl<S: Clone> Clone for GraphQLResponse<S>
Source§fn clone(&self) -> GraphQLResponse<S>
fn clone(&self) -> GraphQLResponse<S>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<S: Debug> Debug for GraphQLResponse<S>
impl<S: Debug> Debug for GraphQLResponse<S>
Source§impl<S: PartialEq> PartialEq for GraphQLResponse<S>
impl<S: PartialEq> PartialEq for GraphQLResponse<S>
Source§impl<T> Serialize for GraphQLResponse<T>
impl<T> Serialize for GraphQLResponse<T>
impl<S> StructuralPartialEq for GraphQLResponse<S>
Auto Trait Implementations§
impl<S> Freeze for GraphQLResponse<S>where
S: Freeze,
impl<S> RefUnwindSafe for GraphQLResponse<S>where
S: RefUnwindSafe,
impl<S> Send for GraphQLResponse<S>where
S: Send,
impl<S> Sync for GraphQLResponse<S>where
S: Sync,
impl<S> Unpin for GraphQLResponse<S>where
S: Unpin,
impl<S> UnwindSafe for GraphQLResponse<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more