[][src]Struct graphql_client::Response

pub struct Response<Data> {
    pub data: Option<Data>,
    pub errors: Option<Vec<Error>>,

The generic shape taken by the responses of GraphQL APIs.

This will generally be used with the ResponseData struct from a derived module.


use graphql_client::Response;

let body: Response<ResponseData> = serde_json::from_value(json!({
    "data": {
        "users": [{"id": 13}],
        "dogs": [{"name": "Strelka"}],
    "errors": [],

let expected: Response<ResponseData> = Response {
    data: Some(ResponseData {
        users: vec![User { id: 13 }],
        dogs: vec![Dog { name: "Strelka".to_owned() }],
    errors: Some(vec![]),

assert_eq!(body, expected);


data: Option<Data>

The absent, partial or complete response data.

errors: Option<Vec<Error>>

The top-level errors returned by the server.

Trait Implementations

impl<Data: Debug> Debug for Response<Data>[src]

impl<'de, Data> Deserialize<'de> for Response<Data> where
    Data: Deserialize<'de>, 

impl<Data: PartialEq> PartialEq<Response<Data>> for Response<Data>[src]

impl<Data> Serialize for Response<Data> where
    Data: Serialize

impl<Data> StructuralPartialEq for Response<Data>[src]

Auto Trait Implementations

impl<Data> RefUnwindSafe for Response<Data> where
    Data: RefUnwindSafe

impl<Data> Send for Response<Data> where
    Data: Send

impl<Data> Sync for Response<Data> where
    Data: Sync

impl<Data> Unpin for Response<Data> where
    Data: Unpin

impl<Data> UnwindSafe for Response<Data> where
    Data: UnwindSafe

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.