Struct async_graphql_rocket::GraphQLRequest
source · [−]pub struct GraphQLRequest(pub Request);
Expand description
A GraphQL request which can be extracted from the request’s body.
Examples
ⓘ
#[rocket::post("/graphql", data = "<request>", format = "application/json", rank = 2)]
async fn graphql_request(schema: State<'_, ExampleSchema>, request: Request) -> Result<Response, Status> {
request.execute(&schema).await
}
Tuple Fields
0: Request
Implementations
sourceimpl GraphQLRequest
impl GraphQLRequest
sourcepub async fn execute<Query, Mutation, Subscription>(
self,
schema: &Schema<Query, Mutation, Subscription>
) -> GraphQLResponse where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
pub async fn execute<Query, Mutation, Subscription>(
self,
schema: &Schema<Query, Mutation, Subscription>
) -> GraphQLResponse where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
Shortcut method to execute the request on the schema.
Trait Implementations
sourceimpl Debug for GraphQLRequest
impl Debug for GraphQLRequest
sourceimpl From<GraphQLQuery> for GraphQLRequest
impl From<GraphQLQuery> for GraphQLRequest
sourcefn from(query: GraphQLQuery) -> Self
fn from(query: GraphQLQuery) -> Self
Converts to this type from the input type.
sourceimpl<'r> FromData<'r> for GraphQLRequest
impl<'r> FromData<'r> for GraphQLRequest
type Error = ParseRequestError
type Error = ParseRequestError
The associated error to be returned when the guard fails.
sourcefn from_data<'life0, 'async_trait>(
req: &'r Request<'life0>,
data: Data<'r>
) -> Pin<Box<dyn Future<Output = Outcome<'r, Self>> + Send + 'async_trait>> where
'r: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn from_data<'life0, 'async_trait>(
req: &'r Request<'life0>,
data: Data<'r>
) -> Pin<Box<dyn Future<Output = Outcome<'r, Self>> + Send + 'async_trait>> where
'r: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Asynchronously validates, parses, and converts an instance of Self
from the incoming request body data. Read more
Auto Trait Implementations
impl !RefUnwindSafe for GraphQLRequest
impl Send for GraphQLRequest
impl Sync for GraphQLRequest
impl Unpin for GraphQLRequest
impl !UnwindSafe for GraphQLRequest
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
F: FnMut(T) -> U,
A: Array<Item = U>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more