Document features
This commit is contained in:
parent
492bba1cdd
commit
e2f53cc30f
|
@ -17,6 +17,8 @@ readme = "README.md"
|
|||
default = ["apollo_tracing", "bson", "chrono", "chrono-tz", "log", "multipart", "tracing", "url"]
|
||||
apollo_tracing = ["chrono"]
|
||||
multipart = ["multer", "bytes", "tempfile"]
|
||||
# Used for doc(cfg())
|
||||
nightly = []
|
||||
|
||||
[dependencies]
|
||||
async-graphql-derive = { path = "derive", version = "2.0.0-alpha.8" }
|
||||
|
@ -52,6 +54,9 @@ tempfile = { version = "3.1.0", optional = true }
|
|||
[dev-dependencies]
|
||||
async-std = { version = "1.5.0", features = ["attributes"] }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["nightly"]
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"parser",
|
||||
|
|
|
@ -331,6 +331,7 @@ pub enum ParseRequestError {
|
|||
/// The request's multipart data was invalid.
|
||||
#[error("Invalid multipart data")]
|
||||
#[cfg(feature = "multipart")]
|
||||
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||
InvalidMultipart(multer::Error),
|
||||
|
||||
/// 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.
|
||||
/// 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.
|
||||
#[cfg_attr(feature = "nightly", doc(cfg(feature = "apollo_tracing")))]
|
||||
pub struct ApolloTracing {
|
||||
start_time: DateTime<Utc>,
|
||||
end_time: DateTime<Utc>,
|
||||
|
|
|
@ -7,6 +7,7 @@ use std::borrow::Cow;
|
|||
use uuid::Uuid;
|
||||
|
||||
/// Logger extension
|
||||
#[cfg_attr(feature = "nightly", doc(cfg(feature = "log")))]
|
||||
pub struct Logger {
|
||||
id: Uuid,
|
||||
enabled: bool,
|
||||
|
|
|
@ -8,8 +8,9 @@ use uuid::Uuid;
|
|||
///
|
||||
/// # References
|
||||
///
|
||||
/// https://crates.io/crates/tracing
|
||||
/// <https://crates.io/crates/tracing>
|
||||
#[derive(Default)]
|
||||
#[cfg_attr(feature = "nightly", doc(cfg(feature = "tracing")))]
|
||||
pub struct Tracing {
|
||||
root_id: Option<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
|
||||
/// `receive_json`.
|
||||
#[cfg(feature = "multipart")]
|
||||
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||
pub async fn receive_body(
|
||||
content_type: Option<impl AsRef<str>>,
|
||||
body: impl AsyncRead + Send + 'static,
|
||||
|
|
|
@ -12,6 +12,7 @@ use std::task::{Context, Poll};
|
|||
/// Options for `receive_multipart`.
|
||||
#[derive(Default, Clone)]
|
||||
#[non_exhaustive]
|
||||
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||
pub struct MultipartOptions {
|
||||
/// The maximum file size.
|
||||
pub max_file_size: Option<usize>,
|
||||
|
@ -38,6 +39,7 @@ impl MultipartOptions {
|
|||
}
|
||||
|
||||
/// Receive a multipart request.
|
||||
#[cfg_attr(feature = "nightly", doc(cfg(feature = "multipart")))]
|
||||
pub async fn receive_multipart(
|
||||
body: impl AsyncRead + Send + 'static,
|
||||
boundary: impl Into<String>,
|
||||
|
|
19
src/lib.rs
19
src/lib.rs
|
@ -59,8 +59,8 @@
|
|||
//! 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)
|
||||
//! (./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
|
||||
|
@ -91,12 +91,25 @@
|
|||
//!
|
||||
//! 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)]
|
||||
#![allow(clippy::needless_lifetimes)]
|
||||
#![allow(clippy::trivially_copy_pass_by_ref)]
|
||||
#![recursion_limit = "256"]
|
||||
#![forbid(unsafe_code)]
|
||||
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
|
||||
|
||||
mod base;
|
||||
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.
|
||||
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Serialize, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
pub struct ID(pub String);
|
||||
|
||||
impl Deref for ID {
|
||||
|
|
Loading…
Reference in New Issue