Document features
This commit is contained in:
parent
509c92a11f
commit
f82322045e
|
@ -17,6 +17,8 @@ readme = "README.md"
|
||||||
default = ["apollo_tracing", "bson", "chrono", "chrono-tz", "log", "multipart", "tracing", "url"]
|
default = ["apollo_tracing", "bson", "chrono", "chrono-tz", "log", "multipart", "tracing", "url"]
|
||||||
apollo_tracing = ["chrono"]
|
apollo_tracing = ["chrono"]
|
||||||
multipart = ["multer", "bytes", "tempfile"]
|
multipart = ["multer", "bytes", "tempfile"]
|
||||||
|
# Used for doc(cfg())
|
||||||
|
nightly = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-graphql-derive = { path = "derive", version = "2.0.0-alpha.8" }
|
async-graphql-derive = { path = "derive", version = "2.0.0-alpha.8" }
|
||||||
|
@ -52,6 +54,9 @@ tempfile = { version = "3.1.0", optional = true }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
async-std = { version = "1.5.0", features = ["attributes"] }
|
async-std = { version = "1.5.0", features = ["attributes"] }
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
features = ["nightly"]
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"parser",
|
"parser",
|
||||||
|
|
|
@ -331,6 +331,7 @@ pub enum ParseRequestError {
|
||||||
/// The request's multipart data was invalid.
|
/// The request's multipart data was invalid.
|
||||||
#[error("Invalid multipart data")]
|
#[error("Invalid multipart data")]
|
||||||
#[cfg(feature = "multipart")]
|
#[cfg(feature = "multipart")]
|
||||||
|
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||||
InvalidMultipart(multer::Error),
|
InvalidMultipart(multer::Error),
|
||||||
|
|
||||||
/// Missing "operators" part for multipart request.
|
/// Missing "operators" part for multipart request.
|
||||||
|
|
|
@ -51,6 +51,7 @@ impl Serialize for ResolveStat {
|
||||||
/// have access to performance traces alongside the data returned by your query.
|
/// have access to performance traces alongside the data returned by your query.
|
||||||
/// It's already supported by `Apollo Engine`, and we're excited to see what other kinds of
|
/// It's already supported by `Apollo Engine`, and we're excited to see what other kinds of
|
||||||
/// integrations people can build on top of this format.
|
/// integrations people can build on top of this format.
|
||||||
|
#[cfg_attr(feature = "nightly", doc(cfg(feature = "apollo_tracing")))]
|
||||||
pub struct ApolloTracing {
|
pub struct ApolloTracing {
|
||||||
start_time: DateTime<Utc>,
|
start_time: DateTime<Utc>,
|
||||||
end_time: DateTime<Utc>,
|
end_time: DateTime<Utc>,
|
||||||
|
|
|
@ -7,6 +7,7 @@ use std::borrow::Cow;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
/// Logger extension
|
/// Logger extension
|
||||||
|
#[cfg_attr(feature = "nightly", doc(cfg(feature = "log")))]
|
||||||
pub struct Logger {
|
pub struct Logger {
|
||||||
id: Uuid,
|
id: Uuid,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
|
|
|
@ -8,8 +8,9 @@ use uuid::Uuid;
|
||||||
///
|
///
|
||||||
/// # References
|
/// # References
|
||||||
///
|
///
|
||||||
/// https://crates.io/crates/tracing
|
/// <https://crates.io/crates/tracing>
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
#[cfg_attr(feature = "nightly", doc(cfg(feature = "tracing")))]
|
||||||
pub struct Tracing {
|
pub struct Tracing {
|
||||||
root_id: Option<Id>,
|
root_id: Option<Id>,
|
||||||
fields: BTreeMap<usize, Id>,
|
fields: BTreeMap<usize, Id>,
|
||||||
|
|
|
@ -21,6 +21,7 @@ use futures::AsyncReadExt;
|
||||||
/// If the content type is multipart it will use `receive_multipart`, otherwise it will use
|
/// If the content type is multipart it will use `receive_multipart`, otherwise it will use
|
||||||
/// `receive_json`.
|
/// `receive_json`.
|
||||||
#[cfg(feature = "multipart")]
|
#[cfg(feature = "multipart")]
|
||||||
|
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||||
pub async fn receive_body(
|
pub async fn receive_body(
|
||||||
content_type: Option<impl AsRef<str>>,
|
content_type: Option<impl AsRef<str>>,
|
||||||
body: impl AsyncRead + Send + 'static,
|
body: impl AsyncRead + Send + 'static,
|
||||||
|
|
|
@ -12,6 +12,7 @@ use std::task::{Context, Poll};
|
||||||
/// Options for `receive_multipart`.
|
/// Options for `receive_multipart`.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||||
pub struct MultipartOptions {
|
pub struct MultipartOptions {
|
||||||
/// The maximum file size.
|
/// The maximum file size.
|
||||||
pub max_file_size: Option<usize>,
|
pub max_file_size: Option<usize>,
|
||||||
|
@ -38,6 +39,7 @@ impl MultipartOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Receive a multipart request.
|
/// Receive a multipart request.
|
||||||
|
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||||
pub async fn receive_multipart(
|
pub async fn receive_multipart(
|
||||||
body: impl AsyncRead + Send + 'static,
|
body: impl AsyncRead + Send + 'static,
|
||||||
boundary: impl Into<String>,
|
boundary: impl Into<String>,
|
||||||
|
|
19
src/lib.rs
19
src/lib.rs
|
@ -59,8 +59,8 @@
|
||||||
//! Licensed under either of
|
//! Licensed under either of
|
||||||
//!
|
//!
|
||||||
//! * Apache License, Version 2.0,
|
//! * Apache License, Version 2.0,
|
||||||
//! (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
|
//! (./LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
|
||||||
//! * MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)
|
//! * MIT license (./LICENSE-MIT or <http://opensource.org/licenses/MIT>)
|
||||||
//! at your option.
|
//! at your option.
|
||||||
//!
|
//!
|
||||||
//! ## References
|
//! ## References
|
||||||
|
@ -91,12 +91,25 @@
|
||||||
//!
|
//!
|
||||||
//! Now a HTML report is available at `benchmark/target/criterion/report`.
|
//! Now a HTML report is available at `benchmark/target/criterion/report`.
|
||||||
//!
|
//!
|
||||||
|
//! # Crate features
|
||||||
|
//!
|
||||||
|
//! This crate offers the following features, all of which are activated by default:
|
||||||
|
//!
|
||||||
|
//! - `apollo_tracing`: Enable the [Apollo tracing
|
||||||
|
//! extension](extensions/struct.ApolloTracing.html).
|
||||||
|
//! - `log`: Enable the [logger extension](extensions/struct.Logger.html).
|
||||||
|
//! - `tracing`: Enable the [tracing extension](extensions/struct.Tracing.html).
|
||||||
|
//! - `multipart`: Support [sending files over HTTP multipart](http/fn.receive_multipart.html).
|
||||||
|
//! - `bson`: Integrate with the [`bson` crate](https://crates.io/crates/bson).
|
||||||
|
//! - `chrono`: Integrate with the [`chrono` crate](https://crates.io/crates/chrono).
|
||||||
|
//! - `chrono-tz`: Integrate with the [`chrono-tz` crate](https://crates.io/crates/chrono-tz).
|
||||||
|
//! - `url`: Integrate with the [`url` crate](https://crates.io/crates/url).
|
||||||
|
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
#![allow(clippy::needless_lifetimes)]
|
|
||||||
#![allow(clippy::trivially_copy_pass_by_ref)]
|
#![allow(clippy::trivially_copy_pass_by_ref)]
|
||||||
#![recursion_limit = "256"]
|
#![recursion_limit = "256"]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
|
||||||
|
|
||||||
mod base;
|
mod base;
|
||||||
mod context;
|
mod context;
|
||||||
|
|
|
@ -10,6 +10,7 @@ use std::ops::{Deref, DerefMut};
|
||||||
///
|
///
|
||||||
/// The input is a `&str`, `String`, `usize` or `uuid::UUID`, and the output is a string.
|
/// The input is a `&str`, `String`, `usize` or `uuid::UUID`, and the output is a string.
|
||||||
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(transparent)]
|
||||||
pub struct ID(pub String);
|
pub struct ID(pub String);
|
||||||
|
|
||||||
impl Deref for ID {
|
impl Deref for ID {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user