Struct juniper_rocket::GraphQLResponse [−][src]
pub struct GraphQLResponse(pub Status, pub String);
Expand description
Simple wrapper around the result of executing a GraphQL query
Implementations
Constructs an error response outside of the normal execution flow
Examples
#[rocket::get("/graphql?<request..>")] fn get_graphql_handler( cookies: &CookieJar, context: &State<Database>, request: juniper_rocket::GraphQLRequest, schema: &State<Schema>, ) -> juniper_rocket::GraphQLResponse { if cookies.get("user_id").is_none() { let err = FieldError::new("User is not logged in", Value::null()); return juniper_rocket::GraphQLResponse::error(err); } request.execute_sync(&*schema, &*context) }
Trait Implementations
Returns Ok
if a Response
could be generated successfully. Otherwise,
returns an Err
with a failing Status
. Read more
Auto Trait Implementations
impl RefUnwindSafe for GraphQLResponse
impl Send for GraphQLResponse
impl Sync for GraphQLResponse
impl Unpin for GraphQLResponse
impl UnwindSafe for GraphQLResponse
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
pub fn vzip(self) -> V