From 286466fcc9fbbf22481230e9cda4ef0f270f5210 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 13 Oct 2019 23:19:34 +0200 Subject: [PATCH] finally get rid of the helper --- gotham_restful/src/helper.rs | 23 ----------------------- gotham_restful/src/lib.rs | 5 ++--- gotham_restful_derive/src/openapi_type.rs | 4 ++-- 3 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 gotham_restful/src/helper.rs diff --git a/gotham_restful/src/helper.rs b/gotham_restful/src/helper.rs deleted file mode 100644 index 7d2969c..0000000 --- a/gotham_restful/src/helper.rs +++ /dev/null @@ -1,23 +0,0 @@ -#[cfg(feature = "openapi")] -pub mod openapi -{ - pub use indexmap::IndexMap; - pub use openapiv3::{ObjectType, ReferenceOr, Schema, SchemaData, SchemaKind, StringType, Type, VariantOrUnknownOrEmpty}; -} - -#[macro_export] -macro_rules! rest_resource { - ($res_name:ident, $route:ident => $setup:block) => { - pub struct $res_name; - - impl ::gotham_restful::Resource for $res_name - { - fn name() -> String - { - stringify!($res_name).to_string() - } - - fn setup(mut $route : D) $setup - } - } -} diff --git a/gotham_restful/src/lib.rs b/gotham_restful/src/lib.rs index 3a37cd1..47d0a50 100644 --- a/gotham_restful/src/lib.rs +++ b/gotham_restful/src/lib.rs @@ -5,6 +5,7 @@ pub use hyper::StatusCode; use serde::{de::DeserializeOwned, Serialize}; pub use gotham_restful_derive::*; + /// Not public API #[doc(hidden)] pub mod export @@ -12,11 +13,9 @@ pub mod export #[cfg(feature = "openapi")] pub use indexmap::IndexMap; #[cfg(feature = "openapi")] - pub use openapiv3; + pub use openapiv3 as openapi; } -pub mod helper; - #[cfg(feature = "openapi")] pub mod openapi; #[cfg(feature = "openapi")] diff --git a/gotham_restful_derive/src/openapi_type.rs b/gotham_restful_derive/src/openapi_type.rs index 7138da1..30aeb2b 100644 --- a/gotham_restful_derive/src/openapi_type.rs +++ b/gotham_restful_derive/src/openapi_type.rs @@ -48,7 +48,7 @@ fn expand_enum(input : ItemEnum) -> TokenStream2 { fn to_schema() -> ::gotham_restful::OpenapiSchema { - use ::gotham_restful::{helper::openapi::*, OpenapiSchema}; + use ::gotham_restful::{export::openapi::*, OpenapiSchema}; let mut enumeration : Vec = Vec::new(); @@ -130,7 +130,7 @@ pub fn expand_struct(input : ItemStruct) -> TokenStream2 { fn to_schema() -> ::gotham_restful::OpenapiSchema { - use ::gotham_restful::{helper::openapi::*, OpenapiSchema}; + use ::gotham_restful::{export::{openapi::*, IndexMap}, OpenapiSchema}; let mut properties : IndexMap>> = IndexMap::new(); let mut required : Vec = Vec::new();