Movatterモバイル変換


[0]ホーム

URL:


Docs.rs

Crateasync_graphql

Source
Expand description

§A GraphQL server library implemented in Rust

Crates.io versionDownloaddocs.rs docsUnsafe Rust forbidden

§Documentation

§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 bydefault:

featureenables
apollo_tracingEnable theApollo tracing extension.
apollo_persisted_queriesEnable theApollo persisted queries extension.
boxed-traitEnablesasync-trait for all traits.
bsonIntegrate with thebson crate.
bigdecimalIntegrate with thebigdecimal crate.
cborSupport forserde_cbor.
chronoIntegrate with thechrono crate.
chrono-tzIntegrate with thechrono-tz crate.
dataloaderSupportDataLoader.
decimalIntegrate with therust_decimal crate.
dynamic-schemaSupport dynamic schema
fast_chemailIntegrate with thefast_chemail crate.
graphiqlEnables theGraphiQL IDE integration
hashbrownIntegrate with thehashbrown crate.
logEnable theLogger extension.
opentelemetryEnable theOpenTelemetry extension.
playgroundEnables theGraphQL playground IDE integration
rawvalueSupport raw values fromserde_json
secrecyIntegrate with thesecrecy crate.
smol_strIntegrate with thesmol_str crate.
string_numberEnable theStringNumber.
timeIntegrate with thetime crate.
tracingEnable theTracing extension.
tempfileSave the uploaded content in the temporary file.
tokio-syncIntegrate with thetokio::sync::RwLock andtokio::sync::Mutex.
unblockSupportAsynchronous reader for Upload
uuidIntegrate with theuuid crate.
urlIntegrate with theurl crate.

§Integrations

§License

Licensed under either of

§References

§Examples

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

Run an example:

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

§Benchmarks

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

cd benchmarkcargo bench

Now a HTML report is available atbenchmark/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 useasync_graphql_parser as parser;
pub usecontext::*;
pub usetypes::*;

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 implementingOutputType::resolve.
types
Useful GraphQL types.

Macros§

scalar
Define a scalar
value
Construct aConstValue.

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 anarray 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 example1 or"Hello World!".

Traits§

CustomDirective
Represents a custom directive.
CustomValidator
Represents a custom input value validator.
ErrorExtensions
An error which can be extended into aError.
Executor
Represents a GraphQL executor
Guard
Field guard
GuardExt
An extension trait forGuard.
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 aResult’s error value withErrorExtensions.
SubscriptionType
A GraphQL subscription object
TypeName
Used to specify the GraphQL Type name.
UnionType
A GraphQL interface.

Functions§

from_value
Interpret aConstValue as an instance of typeT.
to_value
Convert aT intoConstValue which is an enum that can represent anyvalid GraphQL data.

Type Aliases§

FieldError
An alias ofasync_graphql::Error. Present for backwardcompatibility reasons.
FieldResult
An alias ofasync_graphql::Result. Present for backwardcompatibility reasons.
InputValueResult
An error parsing a value of typeT.
Result
An alias forResult<T, Error>.
ServerResult
Alias forResult<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 toObject,Scalar orSubscription.
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

[8]ページ先頭

©2009-2025 Movatter.jp