From 8ce37b09e843ee3d114193fa7b2782b8c6d1863a Mon Sep 17 00:00:00 2001 From: msrd0 Date: Sat, 6 Nov 2021 16:30:47 +0100 Subject: [PATCH] update documentation on gotham_derive crate (#576) --- gotham/src/state/data.rs | 10 +++------- gotham/src/state/mod.rs | 11 +++-------- gotham_derive/src/lib.rs | 3 +++ middleware/template/src/lib.rs | 4 ---- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/gotham/src/state/data.rs b/gotham/src/state/data.rs index 4c125fc66..0796ed4cc 100644 --- a/gotham/src/state/data.rs +++ b/gotham/src/state/data.rs @@ -12,16 +12,12 @@ pub use gotham_derive::StateData; /// A marker trait for types that can be stored in `State`. /// -/// This is typically implemented using `#[derive(StateData)]`, which is provided by the -/// `gotham_derive` crate. +/// This is typically implemented using `#[derive(StateData)]`. /// /// ```rust -/// # extern crate gotham; -/// # #[macro_use] -/// # extern crate gotham_derive; -/// # /// # use gotham::state::{FromState, State}; -/// # +/// use gotham::state::StateData; +/// /// #[derive(StateData)] /// struct MyStateData { /// x: u32, diff --git a/gotham/src/state/mod.rs b/gotham/src/state/mod.rs index db184a8f7..deb9ff268 100644 --- a/gotham/src/state/mod.rs +++ b/gotham/src/state/mod.rs @@ -47,23 +47,18 @@ impl Hasher for IdHasher { } /// Provides storage for request state, and stores one item of each type. The types used for -/// storage must implement the `gotham::state::StateData` trait to allow its storage. The -/// `gotham_derive` crate provides a custom derive for `StateData` to make this more convenient. +/// storage must implement the [`StateData`] trait to allow its storage, which is usually done +/// by adding `#[derive(StateData)]` on the type in question. /// /// # Examples /// /// ```rust -/// extern crate gotham; -/// #[macro_use] -/// extern crate gotham_derive; -/// -/// use gotham::state::State; +/// use gotham::state::{State, StateData}; /// /// #[derive(StateData)] /// struct MyStruct { /// value: i32, /// } -/// /// # fn main() { /// # State::with_new(|state| { /// # diff --git a/gotham_derive/src/lib.rs b/gotham_derive/src/lib.rs index d8f535f74..3ef86a0f1 100644 --- a/gotham_derive/src/lib.rs +++ b/gotham_derive/src/lib.rs @@ -1,3 +1,6 @@ +//! This crate is a private implementation detail of `gotham`. You should never have to +//! use this crate directly. + mod extenders; mod new_middleware; mod state; diff --git a/middleware/template/src/lib.rs b/middleware/template/src/lib.rs index 27ac254f1..a8a2d5c59 100644 --- a/middleware/template/src/lib.rs +++ b/middleware/template/src/lib.rs @@ -9,10 +9,6 @@ #[macro_use] extern crate log; -// Enable to use #[derive(StateData)] below -//#[macro_use] -//extern crate gotham_derive; - use std::pin::Pin; use futures_util::future::{self, FutureExt, TryFutureExt};