Document codegen lints.

This commit is contained in:
Sergio Benitez 2017-02-02 23:06:35 -08:00
parent 84abac7f2b
commit a6c27b7243
1 changed files with 23 additions and 4 deletions

View File

@ -1,9 +1,10 @@
//! # Rocket - Code Generation //! # Rocket - Code Generation
//! //!
//! This crate implements the code generation portions of Rocket. This includes //! This crate implements the code generation portions of Rocket. This includes
//! custom derives, custom attributes, and procedural macros. The documentation //! custom derives, custom attributes, procedural macros, and lints. The
//! here is purely technical. The code generation facilities are documented //! documentation here is purely technical. The code generation facilities are
//! thoroughly in the [Rocket programming guide](https://rocket.rs/guide). //! documented thoroughly in the [Rocket programming
//! guide](https://rocket.rs/guide).
//! //!
//! ## Custom Attributes //! ## Custom Attributes
//! //!
@ -20,7 +21,8 @@
//! * **error** //! * **error**
//! //!
//! The grammar for all _route_ attributes, including **route**, **get**, //! The grammar for all _route_ attributes, including **route**, **get**,
//! **put**, **post**, **delete**, **head**, and **patch**, is defined as: //! **put**, **post**, **delete**, **head**, **patch**, and **options** is
//! defined as:
//! //!
//! <pre> //! <pre>
//! route := METHOD? '(' ('path' '=')? path (',' kv_param)* ')' //! route := METHOD? '(' ('path' '=')? path (',' kv_param)* ')'
@ -58,6 +60,10 @@
//! error := INTEGER //! error := INTEGER
//! </pre> //! </pre>
//! //!
//! A use of the `error` attribute looks like:
//!
//! #[error(404)]
//!
//! ## Custom Derives //! ## Custom Derives
//! //!
//! This crate implements the following custom derives: //! This crate implements the following custom derives:
@ -79,6 +85,19 @@
//! PATH := a path, as defined by Rust //! PATH := a path, as defined by Rust
//! </pre> //! </pre>
//! //!
//! ## Lints
//!
//! This crate implements the following lints:
//!
//! * **unmounted_route**: defaults to _warn_
//!
//! emits a warning when a declared route is not mounted
//!
//! * **unmanaged_state**: defaults to _warn_
//!
//! emits a warning when a `State<T>` request guest is used in a mounted
//! route without managing a value for `T`
//!
//! # Debugging Codegen //! # Debugging Codegen
//! //!
//! When the `ROCKET_CODEGEN_DEBUG` environment variable is set, this crate logs //! When the `ROCKET_CODEGEN_DEBUG` environment variable is set, this crate logs