Docs.rs
  • async-graphql-7.0.17
    • async-graphql 7.0.17
    • Permalink
    • Docs.rs crate page
    • MIT OR Apache-2.0
    • Links
    • Homepage
    • Repository
    • crates.io
    • Source
    • Owners
    • sunli829
    • Dependencies
      • async-graphql-derive ^7.0.17 normal
      • async-graphql-parser ^7.0.17 normal
      • async-graphql-value ^7.0.17 normal
      • async-stream ^0.3.5 normal
      • async-trait ^0.1.79 normal
      • base64 ^0.22.0 normal
      • bigdecimal >=0.3.0, <0.5.0 normal optional
      • blocking ^1.6.1 normal optional
      • bson ^2.9.0 normal optional
      • bytes ^1.6.0 normal
      • chrono ^0.4.37 normal optional
      • chrono-tz ^0.10.0 normal optional
      • fast_chemail ^0.9.6 normal optional
      • fnv ^1.0.7 normal
      • futures-channel ^0.3.30 normal optional
      • futures-timer ^3.0.3 normal
      • futures-util ^0.3.30 normal
      • handlebars ^5.1.2 normal optional
      • hashbrown ^0.14.5 normal optional
      • http ^1.1.0 normal
      • indexmap ^2 normal
      • iso8601 ^0.6.1 normal optional
      • log ^0.4.21 normal optional
      • lru ^0.12.3 normal optional
      • mime ^0.3.17 normal
      • multer ^3.0.0 normal
      • num-traits ^0.2.18 normal
      • opentelemetry ^0.27.0 normal optional
      • pin-project-lite ^0.2.14 normal
      • regex ^1.10.4 normal
      • rust_decimal ^1.35.0 normal optional
      • schemars ^0.8.21 normal optional
      • secrecy ^0.10.3 normal optional
      • serde ^1.0.197 normal
      • serde_cbor ^0.11.2 normal optional
      • serde_json ^1.0.115 normal
      • serde_urlencoded ^0.7.1 normal
      • sha2 ^0.10.8 normal optional
      • smol_str ^0.3.1 normal optional
      • static_assertions_next ^1.1.2 normal
      • tempfile ^3.10.1 normal optional
      • thiserror ^1.0.58 normal
      • time ^0.3.36 normal optional
      • tokio ^1.37.0 normal optional
      • tracing-futures ^0.2.5 normal optional
      • tracing ^0.1.40 normal optional
      • url ^2.5.0 normal optional
      • uuid ^1.8.0 normal optional
      • zxcvbn ^2.2.2 normal optional
      • criterion ^0.5.1 dev
      • futures-channel ^0.3.30 dev
      • slab ^0.4.9 dev
      • tokio ^1.37.0 dev
    • Versions
    • 100% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate async_graphql

async_graphql7.0.17

  • All Items

Sections

  • A GraphQL server library implemented in Rust
    • Documentation
    • Features
    • Crate features
    • Integrations
    • License
    • References
    • Examples
    • Benchmarks

Crate Items

  • Re-exports
  • Modules
  • Macros
  • Structs
  • Enums
  • Traits
  • Functions
  • Type Aliases
  • Attribute Macros
  • Derive Macros

Crates

  • async_graphql

Crate async_graphql

Source
Expand description

§A GraphQL server library implemented in Rust

Crates.io version Download docs.rs docs Unsafe Rust forbidden

§Documentation

  • Book
  • 中文文档
  • Docs
  • GitHub repository
  • Cargo package
  • Minimum supported Rust version: 1.56.1 or later

§Features

  • Fully supports async/await
  • Type safety
  • Rustfmt friendly (Procedural Macro)
  • Custom scalars
  • Minimal overhead
  • Easy integration (poem, actix_web, tide, warp, rocket …)
  • File upload (Multipart request)
  • Subscriptions (WebSocket transport)
  • Custom extensions
  • Apollo Tracing extension
  • Limit query complexity/depth
  • Error Extensions
  • Apollo Federation(v2)
  • Batch Queries
  • Apollo Persisted Queries

§Crate features

This crate offers the following features, all of which are not activated by default:

featureenables
apollo_tracingEnable the Apollo tracing extension.
apollo_persisted_queriesEnable the Apollo persisted queries extension.
boxed-traitEnables async-trait for all traits.
bsonIntegrate with the bson crate.
bigdecimalIntegrate with the bigdecimal crate.
cborSupport for serde_cbor.
chronoIntegrate with the chrono crate.
chrono-tzIntegrate with the chrono-tz crate.
dataloaderSupport DataLoader.
decimalIntegrate with the rust_decimal crate.
dynamic-schemaSupport dynamic schema
fast_chemailIntegrate with the fast_chemail crate.
graphiqlEnables the GraphiQL IDE integration
hashbrownIntegrate with the hashbrown crate.
logEnable the Logger extension.
opentelemetryEnable the OpenTelemetry extension.
playgroundEnables the GraphQL playground IDE integration
rawvalueSupport raw values from serde_json
secrecyIntegrate with the secrecy crate.
smol_strIntegrate with the smol_str crate.
string_numberEnable the StringNumber.
timeIntegrate with the time crate.
tracingEnable the Tracing extension.
tempfileSave the uploaded content in the temporary file.
tokio-syncIntegrate with the tokio::sync::RwLock and tokio::sync::Mutex.
unblockSupport Asynchronous reader for Upload
uuidIntegrate with the uuid crate.
urlIntegrate with the url crate.

§Integrations

  • Poem async-graphql-poem
  • Actix-web async-graphql-actix-web
  • Warp async-graphql-warp
  • Tide async-graphql-tide
  • Rocket async-graphql-rocket
  • Axum async-graphql-axum

§License

Licensed under either of

  • Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.

§References

  • GraphQL
  • GraphQL Multipart Request
  • GraphQL Cursor Connections Specification
  • GraphQL over WebSocket Protocol
  • Apollo Tracing
  • Apollo Federation

§Examples

All examples are in the sub-repository, located in the examples directory.

Run an example:

git submodule update # update the examples repo
cd examples && cargo run --bin [name]

§Benchmarks

Ensure that there is no CPU-heavy process in background!

cd benchmark
cargo bench

Now a HTML report is available at benchmark/target/criterion/report.

Re-exports§

pub use extensions::ResolveFut;
pub use parser::Pos;
pub use parser::Positioned;
pub use resolver_utils::ContainerType;
pub use resolver_utils::EnumType;
pub use resolver_utils::ScalarType;
pub use async_graphql_parser as parser;
pub use context::*;
pub use types::*;

Modules§

context
Query context.
dataloaderdataloader
Batch loading support, used to solve N+1 problem.
dynamicdynamic-schema
Support for dynamic schema
extensions
Extensions for schema
http
A helper module that supports HTTP
resolver_utils
Utilities for implementing OutputType::resolve.
types
Useful GraphQL types.

Macros§

scalar
Define a scalar
value
Construct a ConstValue.

Structs§

CacheControl
Cache control value
DeserializerError
This type represents errors that can occur when deserializing.
Error
An error with a message and optional extensions.
ErrorExtensionValues
Extensions to the error.
Extensions
Extensions of a query.
InputValueError
An error parsing an input value.
Lookahead
A selection performed by a query.
Name
A GraphQL name.
Number
Represents a JSON number, whether integer or floating point.
Request
GraphQL request.
Response
Query response
SDLExportOptions
Options for SDL export
Schema
GraphQL schema.
SchemaBuilder
Schema builder
SerializerError
This type represents errors that can occur when serializing.
ServerError
An error in a GraphQL server.
ValidationResult
Validation results.
Variables
Variables of a query.

Enums§

BatchRequest
Batch support for GraphQL requests, which is either a single query, or an array of queries
BatchResponse
Response for batchable queries
IntrospectionMode
Introspection mode
ParseRequestError
An error parsing the request.
PathSegment
A segment of path to a resolver.
ValidationMode
Validation mode
Value
A resolved GraphQL value, for example 1 or "Hello World!".

Traits§

CustomDirective
Represents a custom directive.
CustomValidator
Represents a custom input value validator.
ErrorExtensions
An error which can be extended into a Error.
Executor
Represents a GraphQL executor
Guard
Field guard
GuardExt
An extension trait for Guard.
InputObjectType
A GraphQL input object.
InputType
Represents a GraphQL input type.
InterfaceType
A GraphQL interface.
ObjectType
A GraphQL object.
OneofObjectType
A GraphQL oneof input object.
OutputType
Represents a GraphQL output type.
ResultExt
Extend a Result’s error value with ErrorExtensions.
SubscriptionType
A GraphQL subscription object
TypeName
Used to specify the GraphQL Type name.
UnionType
A GraphQL interface.

Functions§

from_value
Interpret a ConstValue as an instance of type T.
to_value
Convert a T into ConstValue which is an enum that can represent any valid GraphQL data.

Type Aliases§

FieldError
An alias of async_graphql::Error. Present for backward compatibility reasons.
FieldResult
An alias of async_graphql::Result. Present for backward compatibility reasons.
InputValueResult
An error parsing a value of type T.
Result
An alias for Result<T, Error>.
ServerResult
Alias for Result<T, ServerError>.

Attribute Macros§

ComplexObject
Define a complex GraphQL object for SimpleObject’s complex field resolver.
Directive
Define a directive for query.
Object
Define a GraphQL object with methods
Scalar
Define a Scalar
Subscription
Define a GraphQL subscription
TypeDirective

Derive Macros§

Description
Attach a description to Object, Scalar or Subscription.
Enum
Define a GraphQL enum
InputObject
Define a GraphQL input object
Interface
Define a GraphQL interface
MergedObject
Define a merged object with multiple object types.
MergedSubscription
Define a merged subscription with multiple subscription types.
NewType
Define a NewType Scalar
OneofObject
Define a GraphQL oneof input object
SimpleObject
Define a GraphQL object with fields
Union
Define a GraphQL union

Results

Settings
Help

Type "GQLRequest" not found. Showing results for closest type name "request" instead.

No results :(
Try on DuckDuckGo?

Or try looking in one of these:
  • The Rust Reference for technical details about the language.
  • Rust By Example for expository code examples.
  • The Rust Book for introductions to language features and the language itself.
  • Docs.rs for documentation of crates released on crates.io.
    struct field
    async_graphql::Request::data
    Request -> Data
    The data of the request that can be accessed through …
    method
    async_graphql::BatchRequest::from
    Request -> BatchRequest
    struct field
    async_graphql::Request::query
    Request -> String
    The query source of the request.
    struct field
    async_graphql::Request::uploads
    Request -> Vec
    Uploads sent with the request.
    struct field
    async_graphql::Request::variables
    Request -> Variables
    The variables of the request.
    struct field
    async_graphql::Request::extensions
    Request -> Extensions
    The extensions config of the request.
    struct field
    async_graphql::Request::operation_name
    Request -> Option
    The operation name of the request.
    struct field
    async_graphql::Request::introspection_mode
    Request -> IntrospectionMode
    Sets the introspection mode for this request (defaults to …
    method
    async_graphql::Request::only_introspection
    Request -> Request
    Only allow introspection queries for this request.
    method
    async_graphql::Request::disable_introspection
    Request -> Request
    Disable introspection queries for this request.
    method
    async_graphql::Request::variables
    Request, Variables -> Request
    Specify the variables.
    method
    async_graphql::dynamic::DynamicRequest::from
    T -> DynamicRequest
    where
    T: Into<Request>
    method
    async_graphql::Request::serialize
    &Request, __S -> Result
    method
    async_graphql::Request::operation_name
    Request, T -> Request
    Specify the operation name of the request.
    method
    async_graphql::Request::set_parsed_query
    &mut Request, ExecutableDocument -> ()
    Sets the parsed query into the request.
    method
    async_graphql::Request::fmt
    &Request, &mut Formatter -> Result
    method
    async_graphql::extensions::NextPrepareRequest::run
    NextPrepareRequest, &ExtensionContext, Request -> ServerResult<Request>
    Call the Extension::prepare_request function of next …
    method
    async_graphql::Request::data
    Request, D -> Request
    Insert some data for this request.
    trait method
    async_graphql::Executor::execute
    &Executor, Request -> Pin<Box<Future>>
    Execute a GraphQL query.
    method
    async_graphql::dynamic::Schema::execute
    &Schema, Request -> Pin<Box<Future>>
    method
    async_graphql::Request::set_upload
    &mut Request, &str, UploadValue -> ()
    Set a variable to an upload value.
    method
    async_graphql::Request::parsed_query
    &mut Request -> Result<&ExecutableDocument, ServerError>
    Performs parsing of query ahead of execution.
    trait method
    async_graphql::Executor::execute_stream
    &Executor, Request, Option<Arc<Data>> -> BoxStream<Response>
    Execute a GraphQL subscription with session data.
    method
    async_graphql::dynamic::Schema::execute_stream
    &Schema, Request, Option<Arc<Data>> -> BoxStream<Response>
    method
    async_graphql::extensions::Extension::prepare_request
    &Extension, &ExtensionContext, Request, NextPrepareRequest -> Pin<Box<Future>>
    Called at prepare request.
    method
    async_graphql::Schema::execute
    &Schema<Query, Mutation, Subscription>, undefined -> Response
    where
    undefined: Into<Request>
    Execute a GraphQL query.
    method
    async_graphql::Schema::execute_stream
    &Schema<Query, Mutation, Subscription>, Request, Option<Arc<Data>> -> BoxStream<Response>
    method
    async_graphql::Schema::execute_stream_with_session_data
    &Schema<Query, Mutation, Subscription>, undefined, Arc<Data> -> <Stream<Item=Response>, Send, Unpin>
    where
    undefined: Into<Request>
    Execute a GraphQL subscription with session data.
    struct field
    async_graphql::http::ClientMessage::Start::payload
    Start -> Request
    The GraphQL Request - this can be modified by protocol …
    method
    async_graphql::Request::new
    Into<String> -> Request
    Create a request object with query source.
    method
    async_graphql::Request::from
    T -> Request
    method
    async_graphql::Request::deserialize
    __D -> Result<Request>
    method
    async_graphql::BatchRequest::into_single
    BatchRequest -> Result<Request, ParseRequestError>
    Attempt to convert the batch request into a single request.
    function
    async_graphql::http::receive_cbor
    AsyncRead -> Result<Request, ParseRequestError>
    Receive a GraphQL request from a body as CBOR.
    function
    async_graphql::http::receive_json
    AsyncRead -> Result<Request, ParseRequestError>
    Receive a GraphQL request from a body as JSON.
    function
    async_graphql::http::parse_query_string
    &str -> Result<Request, ParseRequestError>
    Parse a GraphQL request from a query string.
    function
    async_graphql::http::receive_body
    Option<AsRef<str>>, undefined, MultipartOptions -> Result<Request, ParseRequestError>
    Receive a GraphQL request from a content type and body.
    method
    async_graphql::Request::only_introspection
    Request -> Request
    Only allow introspection queries for this request.
    method
    async_graphql::Request::disable_introspection
    Request -> Request
    Disable introspection queries for this request.
    method
    async_graphql::Request::variables
    Request, Variables -> Request
    Specify the variables.
    method
    async_graphql::Request::operation_name
    Request, T -> Request
    Specify the operation name of the request.
    method
    async_graphql::Request::data
    Request, D -> Request
    Insert some data for this request.