[][src]Struct juniper::http::GraphQLResponse

pub struct GraphQLResponse<'a, S = DefaultScalarValue>(_);

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

impl<'a, S> GraphQLResponse<'a, S> where
    S: ScalarValue
[src]

pub fn from_result(
    r: Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError<'a>>
) -> Self
[src]

Constructs new GraphQLResponse using the given result

pub fn error(error: FieldError<S>) -> Self[src]

Constructs an error response outside of the normal execution flow

pub fn is_ok(&self) -> bool[src]

Was the request successful or not?

Note that there still might be errors in the response even though it's considered OK. This is by design in GraphQL.

Trait Implementations

impl<'a, S: Debug> Debug for GraphQLResponse<'a, S>[src]

impl<'a, T> Serialize for GraphQLResponse<'a, T> where
    T: Serialize + ScalarValue,
    Value<T>: Serialize,
    ExecutionError<T>: Serialize,
    GraphQLError<'a>: Serialize
[src]

Auto Trait Implementations

impl<'a, S> RefUnwindSafe for GraphQLResponse<'a, S> where
    S: RefUnwindSafe
[src]

impl<'a, S> Send for GraphQLResponse<'a, S> where
    S: Send
[src]

impl<'a, S> Sync for GraphQLResponse<'a, S> where
    S: Sync
[src]

impl<'a, S> Unpin for GraphQLResponse<'a, S> where
    S: Unpin
[src]

impl<'a, S> UnwindSafe for GraphQLResponse<'a, S> where
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,