Struct async_graphql_poem::GraphQL [−][src]
pub struct GraphQL<Query, Mutation, Subscription> { /* fields omitted */ }Expand description
A GraphQL query endpoint.
Example
use poem::{Route, post};
use async_graphql_poem::GraphQL;
use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema};
struct Query;
#[Object]
impl Query {
async fn value(&self) -> i32 {
100
}
}
type MySchema = Schema<Query, EmptyMutation, EmptySubscription>;
let schema = Schema::new(Query, EmptyMutation, EmptySubscription);
let app = Route::new().at("/", post(GraphQL::new(schema)));Implementations
Trait Implementations
impl<Query, Mutation, Subscription> Endpoint for GraphQL<Query, Mutation, Subscription> where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
impl<Query, Mutation, Subscription> Endpoint for GraphQL<Query, Mutation, Subscription> where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
Auto Trait Implementations
impl<Query, Mutation, Subscription> !RefUnwindSafe for GraphQL<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Send for GraphQL<Query, Mutation, Subscription> where
Mutation: Send + Sync,
Query: Send + Sync,
Subscription: Send + Sync,
impl<Query, Mutation, Subscription> Sync for GraphQL<Query, Mutation, Subscription> where
Mutation: Send + Sync,
Query: Send + Sync,
Subscription: Send + Sync,
impl<Query, Mutation, Subscription> !UnwindSafe for GraphQL<Query, Mutation, Subscription>
Blanket Implementations
Mutably borrows from an owned value. Read more
Wrap the endpoint in a Box.
fn with<T>(self, middleware: T) -> <T as Middleware<Self::Endpoint>>::Output where
T: Middleware<Self::Endpoint>,
fn with<T>(self, middleware: T) -> <T as Middleware<Self::Endpoint>>::Output where
T: Middleware<Self::Endpoint>,
Use middleware to transform this endpoint. Read more
fn with_if<T>(
self,
enable: bool,
middleware: T
) -> EitherEndpoint<Self, <T as Middleware<Self::Endpoint>>::Output> where
T: Middleware<Self::Endpoint>,
fn with_if<T>(
self,
enable: bool,
middleware: T
) -> EitherEndpoint<Self, <T as Middleware<Self::Endpoint>>::Output> where
T: Middleware<Self::Endpoint>,
if enable is true then use middleware to transform this endpoint. Read more
A helper function, similar to with(AddData(T)). Read more
Maps the request of this endpoint. Read more
Maps the output of this endpoint. Read more
Maps the request and response of this endpoint. Read more
fn and_then<F, Fut, Err, R, R2>(self, f: F) -> AndThen<Self::Endpoint, F> where
F: Fn(R) -> Fut + Send + Sync,
Fut: Future<Output = Result<R2, Err>> + Send,
Err: IntoResponse,
R: IntoResponse,
R2: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == Result<R, Err>,
fn and_then<F, Fut, Err, R, R2>(self, f: F) -> AndThen<Self::Endpoint, F> where
F: Fn(R) -> Fut + Send + Sync,
Fut: Future<Output = Result<R2, Err>> + Send,
Err: IntoResponse,
R: IntoResponse,
R2: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == Result<R, Err>,
Calls f if the result is Ok, otherwise returns the Err value of
self. Read more
Maps the response of this endpoint. Read more
fn map_err<F, Fut, InErr, OutErr, R>(self, f: F) -> MapErr<Self::Endpoint, F> where
F: Fn(InErr) -> Fut + Send + Sync,
Fut: Future<Output = OutErr> + Send,
InErr: IntoResponse,
OutErr: IntoResponse,
R: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == Result<R, InErr>,
fn map_err<F, Fut, InErr, OutErr, R>(self, f: F) -> MapErr<Self::Endpoint, F> where
F: Fn(InErr) -> Fut + Send + Sync,
Fut: Future<Output = OutErr> + Send,
InErr: IntoResponse,
OutErr: IntoResponse,
R: IntoResponse,
Self::Endpoint: Endpoint,
Self::Endpoint: Sized,
<Self::Endpoint as Endpoint>::Output == Result<R, InErr>,
Maps the error of this endpoint. Read more
type Endpoint = T
type Endpoint = T
Represents the endpoint type.
Converts this object into endpoint.
pub fn vzip(self) -> V
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more