pub trait GraphqlOperation: Serialize {
    type GenericResponse;
    type Response;
    type Error: Error;

    // Required method
    fn decode(
        &self,
        data: Self::GenericResponse
    ) -> Result<Self::Response, Self::Error>;
}
Expand description

An abstraction over GraphQL operations.

Required Associated Types§

source

type GenericResponse

The “generic” response type. A graphql-ws-client supports running multiple operations at a time. This GenericResponse is what will intially be decoded - with the decode function converting this into the actual operation response.

This type needs to match up with GraphqlClient::Response.

source

type Response

The actual response & error type of this operation.

source

type Error: Error

The error that will be returned from failed attempts to decode a Response.

Required Methods§

source

fn decode( &self, data: Self::GenericResponse ) -> Result<Self::Response, Self::Error>

Decodes a GenericResponse into the actual response that will be returned to users for this operation.

Implementors§