[−][src]Struct juniper_rocket::GraphQLResponse
Simple wrapper around the result of executing a GraphQL query
Methods
impl GraphQLResponse
[src]
pub fn error(error: FieldError) -> Self
[src]
Constructs an error response outside of the normal execution flow
Examples
#[rocket::get("/graphql?<request..>")] fn get_graphql_handler( mut cookies: Cookies, context: State<Database>, request: Form<juniper_rocket::GraphQLRequest>, schema: State<Schema>, ) -> juniper_rocket::GraphQLResponse { if cookies.get_private("user_id").is_none() { let err = FieldError::new("User is not logged in", Value::null()); return juniper_rocket::GraphQLResponse::error(err); } request.execute(&schema, &context) }
pub fn custom(status: Status, response: Value) -> Self
[src]
Constructs a custom response outside of the normal execution flow
This is intended for highly customized integrations and should only be used as a last resort. For normal juniper use, use the response from GraphQLRequest::execute(..).
Trait Implementations
impl<'r> Responder<'r> for GraphQLResponse
[src]
fn respond_to(self, _: &Request) -> Result<Response<'r>, Status>
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,