[−][src]Crate async_graphql
A GraphQL server library implemented in Rust
Documentation
- Feature Comparison
- Book
- 中文文档
- Docs
- GitHub repository
- Cargo package
- Minimum supported Rust version: 1.42 or later
Features
- Fully supports async/await
- Type safety
- Rustfmt friendly (Procedural Macro)
- Custom scalars
- Minimal overhead
- Easy integration (hyper, actix_web, tide ...)
- File upload (Multipart request)
- Subscriptions (WebSocket transport)
- Custom extensions
- Apollo Tracing extension
- Limit query complexity/depth
- Error Extensions
- Apollo Federation
Integrations
- Actix-web async-graphql-actix_web
- Warp async-graphql-warp
- Tide async-graphql-tide
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
If you are just getting started, we recommend checking out our examples at: https://github.com/async-graphql/examples
To see how you would create a Relay-compliant server using async-graphql, warp, diesel & postgresql, you can also check out a real-world example at: https://github.com/phated/twentyfive-stars
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.
Modules
| connection | Types for Relay-compliant server | 
| extensions | Extensions for schema | 
| guard | Field guards | 
| http | A helper module that supports HTTP | 
| transports | Transports for subscription | 
| validators | Input value validators | 
Structs
| Any | Any scalar | 
| CacheControl | Cache control values | 
| ContextBase | Query context | 
| Data | Schema/Context data. | 
| EmptyMutation | Empty mutation | 
| EmptySubscription | Empty subscription | 
| FieldError | An error in a field resolver. | 
| ID | ID scalar | 
| Json | A scalar that can represent any JSON value. | 
| Lookahead | A selection performed by a query | 
| Number | Represents a JSON number, whether integer or floating point. | 
| OutputJson | A  | 
| Pos | Original position of an element in source code. | 
| Positioned | An AST node that stores its original position. | 
| QueryPathNode | The query path node | 
| Request | GraphQL query request | 
| Response | Query response | 
| RuleError | Verification error. | 
| Schema | GraphQL schema. | 
| SchemaBuilder | Schema builder | 
| SimpleBroker | A simple broker based on memory | 
| Upload | Uploaded file | 
| Variables | Variables of a query. | 
Enums
| Error | An error serving a GraphQL query. | 
| InputValueError | An error in the format of an input value. | 
| MaybeUndefined | Similar to  | 
| ParseRequestError | An error parsing the request. | 
| QueryError | An error processing a GraphQL query. | 
| QueryPathSegment | The query path segment | 
| ValidationMode | Validation mode | 
| Value | A resolved GraphQL value, for example  | 
Traits
| ErrorExtensions | An error which can be extended into a  | 
| ResultExt | Extend a  | 
| ScalarType | Represents a GraphQL scalar | 
| Type | Represents a GraphQL type | 
Type Definitions
| Context | Context object for resolve field | 
| FieldResult | An alias for  | 
| InputValueResult | An alias for  | 
| Result | Result type | 
Attribute Macros
| 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. | 
| Object | Define a GraphQL object with methods | 
| Scalar | Define a Scalar | 
| SimpleObject | Define a GraphQL object with fields | 
| Subscription | Define a GraphQL subscription | 
| Union | Define a GraphQL union | 
Derive Macros
| GQLEnum | Derive a GraphQL enum | 
| GQLInputObject | Derive a GraphQL input object | 
| GQLInterface | Derive a GraphQL interface | 
| GQLMergedObject | Derive a GraphQL Merged object | 
| GQLMergedSubscription | Derive a GraphQL merged subscription with multiple subscription types. | 
| GQLSimpleObject | Derive a GraphQL object with fields | 
| GQLUnion | Derive a GraphQL union |