From b88a2d7d0518dfda34aa50e2f92ade7a56d0e47a Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Fri, 7 Dec 2018 09:07:27 -0800 Subject: [PATCH] Add notes about enabling features to contrib docs. --- contrib/lib/src/helmet/mod.rs | 12 ++++++++++++ contrib/lib/src/json.rs | 13 +++++++++++++ contrib/lib/src/msgpack.rs | 12 ++++++++++++ contrib/lib/src/serve.rs | 14 ++++++++++++++ contrib/lib/src/uuid.rs | 14 ++++++++++++++ core/http/src/uri/from_uri_param.rs | 8 ++++++-- 6 files changed, 71 insertions(+), 2 deletions(-) diff --git a/contrib/lib/src/helmet/mod.rs b/contrib/lib/src/helmet/mod.rs index 65682f7b..8db32776 100644 --- a/contrib/lib/src/helmet/mod.rs +++ b/contrib/lib/src/helmet/mod.rs @@ -9,6 +9,18 @@ //! [express]: https://expressjs.com //! [`SpaceHelmet`]: helmet::SpaceHelmet //! +//! # Enabling +//! +//! This module is only available when the `helmet` feature is enabled. Enable +//! it in `Cargo.toml` as follows: +//! +//! ```toml +//! [dependencies.rocket_contrib] +//! version = "0.4.0" +//! default-features = false +//! features = ["helmet"] +//! ``` +//! //! # Supported Headers //! //! | HTTP Header | Description | Policy | Default? | diff --git a/contrib/lib/src/json.rs b/contrib/lib/src/json.rs index bfe503ef..b31d7644 100644 --- a/contrib/lib/src/json.rs +++ b/contrib/lib/src/json.rs @@ -1,6 +1,19 @@ //! Automatic JSON (de)serialization support. //! //! See the [`Json`](json::Json) type for further details. +//! +//! # Enabling +//! +//! This module is only available when the `json` feature is enabled. Enable it +//! in `Cargo.toml` as follows: +//! +//! ```toml +//! [dependencies.rocket_contrib] +//! version = "0.4.0" +//! default-features = false +//! features = ["json"] +//! ``` + extern crate serde; extern crate serde_json; diff --git a/contrib/lib/src/msgpack.rs b/contrib/lib/src/msgpack.rs index 521963fa..252eecae 100644 --- a/contrib/lib/src/msgpack.rs +++ b/contrib/lib/src/msgpack.rs @@ -1,6 +1,18 @@ //! Automatic MessagePack (de)serialization support. //! //! See the [`MsgPack`](msgpack::MessagePack) type for further details. +//! +//! # Enabling +//! +//! This module is only available when the `msgpack` feature is enabled. Enable +//! it in `Cargo.toml` as follows: +//! +//! ```toml +//! [dependencies.rocket_contrib] +//! version = "0.4.0" +//! default-features = false +//! features = ["msgpack"] +//! ``` extern crate serde; extern crate rmp_serde; diff --git a/contrib/lib/src/serve.rs b/contrib/lib/src/serve.rs index 07ac8a75..8c344963 100644 --- a/contrib/lib/src/serve.rs +++ b/contrib/lib/src/serve.rs @@ -1,4 +1,18 @@ //! Custom handler and options for static file serving. +//! +//! See the [`StaticFiles`](serve::StaticFiles) type for further details. +//! +//! # Enabling +//! +//! This module is only available when the `serve` feature is enabled. Enable it +//! in `Cargo.toml` as follows: +//! +//! ```toml +//! [dependencies.rocket_contrib] +//! version = "0.4.0" +//! default-features = false +//! features = ["serve"] +//! ``` use std::path::{PathBuf, Path}; diff --git a/contrib/lib/src/uuid.rs b/contrib/lib/src/uuid.rs index e2979a98..866bce2e 100644 --- a/contrib/lib/src/uuid.rs +++ b/contrib/lib/src/uuid.rs @@ -1,4 +1,18 @@ //! UUID parameter and form value parsing support. +//! +//! See the [`Uuid`](uuid::Uuid) type for further details. +//! +//! # Enabling +//! +//! This module is only available when the `uuid` feature is enabled. Enable it +//! in `Cargo.toml` as follows: +//! +//! ```toml +//! [dependencies.rocket_contrib] +//! version = "0.4.0" +//! default-features = false +//! features = ["uuid"] +//! ``` pub extern crate uuid as uuid_crate; diff --git a/core/http/src/uri/from_uri_param.rs b/core/http/src/uri/from_uri_param.rs index 2a0c9c13..4586a604 100644 --- a/core/http/src/uri/from_uri_param.rs +++ b/core/http/src/uri/from_uri_param.rs @@ -75,12 +75,16 @@ use uri::{self, UriPart, UriDisplay}; /// `u32`, `u64`, `u128`, `usize`, `f32`, `f64`, `bool`, `IpAddr`, /// `Ipv4Addr`, `Ipv6Addr`, `&str`, `&RawStr`, `Cow` /// -/// The following conversions are implemented: +/// The following conversions are implemented, allowing a value of the type on +/// the left to be used when a type on the right is expected by a route: /// /// * `&str` to `String` /// * `&str` to `RawStr` /// * `String` to `&str` /// * `String` to `RawStr` +/// * `T` to `Option` +/// * `T` to `Result` +/// * `T` to `Form` /// /// The following types have _identity_ implementations _only in [`Path`]_: /// @@ -225,7 +229,7 @@ macro_rules! impl_conversion_ref { ); } -/// Macro to automatically generated _identity_ [`FromUriParam`] trait +/// Macro to automatically generate _identity_ [`FromUriParam`] trait /// implementations. /// /// For a type `T`, the _identity_ implementations of `FromUriParam` are: