From 725ee3d3961f9a76105c45579d1e7e8c999fee3c Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 16 Mar 2019 21:43:48 -0700 Subject: [PATCH] rename extract to types --- src/{extract/mod.rs => extract.rs} | 13 +------------ src/lib.rs | 5 +++-- src/{extract => types}/form.rs | 0 src/{extract => types}/json.rs | 0 src/types/mod.rs | 13 +++++++++++++ src/{extract => types}/path.rs | 3 +-- src/{extract => types}/payload.rs | 0 src/{extract => types}/query.rs | 0 8 files changed, 18 insertions(+), 16 deletions(-) rename src/{extract/mod.rs => extract.rs} (97%) rename src/{extract => types}/form.rs (100%) rename src/{extract => types}/json.rs (100%) create mode 100644 src/types/mod.rs rename src/{extract => types}/path.rs (99%) rename src/{extract => types}/payload.rs (100%) rename src/{extract => types}/query.rs (100%) diff --git a/src/extract/mod.rs b/src/extract.rs similarity index 97% rename from src/extract/mod.rs rename to src/extract.rs index 738f8918..4cd04be2 100644 --- a/src/extract/mod.rs +++ b/src/extract.rs @@ -6,18 +6,6 @@ use futures::{future, Async, Future, IntoFuture, Poll}; use crate::service::ServiceFromRequest; -mod form; -mod json; -mod path; -mod payload; -mod query; - -pub use self::form::{Form, FormConfig}; -pub use self::json::{Json, JsonConfig}; -pub use self::path::Path; -pub use self::payload::{Payload, PayloadConfig}; -pub use self::query::Query; - /// Trait implemented by types that can be extracted from request. /// /// Types that implement this trait can be used with `Route` handlers. @@ -250,6 +238,7 @@ mod tests { use super::*; use crate::test::{block_on, TestRequest}; + use crate::types::{Form, FormConfig, Path, Query}; #[derive(Deserialize, Debug, PartialEq)] struct Info { diff --git a/src/lib.rs b/src/lib.rs index 509fcc60..dc0493a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ mod scope; mod server; mod service; pub mod test; +mod types; #[allow(unused_imports)] #[macro_use] @@ -93,9 +94,9 @@ pub mod web { use crate::scope::Scope; pub use crate::data::{Data, RouteData}; - pub use crate::extract::{Form, Json, Path, Payload, Query}; - pub use crate::extract::{FormConfig, JsonConfig, PayloadConfig}; pub use crate::request::HttpRequest; + pub use crate::types::{Form, Json, Path, Payload, Query}; + pub use crate::types::{FormConfig, JsonConfig, PayloadConfig}; /// Create resource for a specific path. /// diff --git a/src/extract/form.rs b/src/types/form.rs similarity index 100% rename from src/extract/form.rs rename to src/types/form.rs diff --git a/src/extract/json.rs b/src/types/json.rs similarity index 100% rename from src/extract/json.rs rename to src/types/json.rs diff --git a/src/types/mod.rs b/src/types/mod.rs new file mode 100644 index 00000000..b5f8de60 --- /dev/null +++ b/src/types/mod.rs @@ -0,0 +1,13 @@ +//! Helper types + +mod form; +mod json; +mod path; +mod payload; +mod query; + +pub use self::form::{Form, FormConfig}; +pub use self::json::{Json, JsonConfig}; +pub use self::path::Path; +pub use self::payload::{Payload, PayloadConfig}; +pub use self::query::Query; diff --git a/src/extract/path.rs b/src/types/path.rs similarity index 99% rename from src/extract/path.rs rename to src/types/path.rs index fc6811c7..4e678479 100644 --- a/src/extract/path.rs +++ b/src/types/path.rs @@ -8,8 +8,7 @@ use serde::de; use crate::request::HttpRequest; use crate::service::ServiceFromRequest; - -use super::FromRequest; +use crate::FromRequest; #[derive(PartialEq, Eq, PartialOrd, Ord)] /// Extract typed information from the request's path. diff --git a/src/extract/payload.rs b/src/types/payload.rs similarity index 100% rename from src/extract/payload.rs rename to src/types/payload.rs diff --git a/src/extract/query.rs b/src/types/query.rs similarity index 100% rename from src/extract/query.rs rename to src/types/query.rs