Enum async_graphql::BatchRequest

source ·
pub enum BatchRequest {
    Single(Request),
    Batch(Vec<Request>),
}
Expand description

Batch support for GraphQL requests, which is either a single query, or an array of queries

Reference: https://www.apollographql.com/blog/batching-client-graphql-queries-a685f5bcd41b/

Variants§

§

Single(Request)

Single query

§

Batch(Vec<Request>)

Non-empty array of queries

Implementations§

source§

impl BatchRequest

source

pub fn into_single(self) -> Result<Request, ParseRequestError>

Attempt to convert the batch request into a single request.

§Errors

Fails if the batch request is a list of requests with a message saying that batch requests aren’t supported.

source

pub fn iter(&self) -> impl Iterator<Item = &Request>

Returns an iterator over the requests.

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Request>

Returns an iterator that allows modifying each request.

source

pub fn variables(self, variables: Variables) -> Self

Specify the variables for each requests.

source

pub fn data<D: Any + Clone + Send + Sync>(self, data: D) -> Self

Insert some data for for each requests.

source

pub fn disable_introspection(self) -> Self

Disable introspection queries for each request.

source

pub fn introspection_only(self) -> Self

Only allow introspection queries for each request.

Trait Implementations§

source§

impl Debug for BatchRequest

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for BatchRequest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<Request> for BatchRequest

source§

fn from(r: Request) -> Self

Converts to this type from the input type.
source§

impl From<Vec<Request>> for BatchRequest

source§

fn from(r: Vec<Request>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

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