From 9119358b0b5743c68a13f1262a3c72a343c0996a Mon Sep 17 00:00:00 2001 From: Quentin Laveau Date: Fri, 8 Sep 2017 09:49:04 +0200 Subject: [PATCH] Rename proc-macro related crates --- Cargo.toml | 4 ++-- examples/hello_macro/Cargo.toml | 8 -------- examples/hello_macros/Cargo.toml | 7 +++++++ examples/{hello_macro => hello_macros}/src/main.rs | 2 -- lib/Cargo.toml | 4 +++- lib/src/lib.rs | 10 ++++++++++ {shio-macro => macros}/Cargo.toml | 2 +- {shio-macro => macros}/src/lib.rs | 0 8 files changed, 23 insertions(+), 14 deletions(-) delete mode 100644 examples/hello_macro/Cargo.toml create mode 100644 examples/hello_macros/Cargo.toml rename examples/{hello_macro => hello_macros}/src/main.rs (91%) rename {shio-macro => macros}/Cargo.toml (90%) rename {shio-macro => macros}/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index f2f5d42..107b127 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ lto = true [workspace] members = [ "lib/", - "shio-macro", + "macros/", "examples/hello", "examples/json", "examples/proxy", @@ -12,5 +12,5 @@ members = [ "examples/redirect", "examples/templates_askama", "examples/postgres", - "examples/hello_macro", + "examples/hello_macros", ] diff --git a/examples/hello_macro/Cargo.toml b/examples/hello_macro/Cargo.toml deleted file mode 100644 index 87ff2e0..0000000 --- a/examples/hello_macro/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "hello_macro" -version = "0.0.0" -workspace = "../.." - -[dependencies] -shio = { path = "../../lib" } -shio-macro = { path = "../../shio-macro" } \ No newline at end of file diff --git a/examples/hello_macros/Cargo.toml b/examples/hello_macros/Cargo.toml new file mode 100644 index 0000000..343cd65 --- /dev/null +++ b/examples/hello_macros/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "hello_macros" +version = "0.0.0" +workspace = "../.." + +[dependencies] +shio = { path = "../../lib", features=["nightly"] } \ No newline at end of file diff --git a/examples/hello_macro/src/main.rs b/examples/hello_macros/src/main.rs similarity index 91% rename from examples/hello_macro/src/main.rs rename to examples/hello_macros/src/main.rs index fc38c30..ac50aae 100644 --- a/examples/hello_macro/src/main.rs +++ b/examples/hello_macros/src/main.rs @@ -1,8 +1,6 @@ #![feature(proc_macro)] extern crate shio; -extern crate shio_macro; -use shio_macro::*; use shio::prelude::*; diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 741c604..3712873 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -22,6 +22,8 @@ regex = "0.2" log = "0.3" typemap = "0.3" +shio_macros = { path="../macros", optional=true } + [features] default = [] -nightly = [] +nightly = ["shio_macros"] diff --git a/lib/src/lib.rs b/lib/src/lib.rs index eec452b..32a9cbe 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,5 +1,6 @@ #![cfg_attr(feature = "cargo-clippy", warn(clippy, clippy_pedantic))] #![cfg_attr(feature = "cargo-clippy", allow(missing_docs_in_private_items))] +#![cfg_attr(feature = "nightly", feature(proc_macro))] extern crate futures; extern crate hyper; @@ -12,6 +13,9 @@ extern crate tokio_core; extern crate tokio_io; extern crate typemap; +#[cfg(feature = "nightly")] +extern crate shio_macros; + pub mod context; mod handler; mod shio; @@ -30,6 +34,9 @@ pub use shio::Shio; pub use context::Context; pub use handler::Handler; +#[cfg(feature = "nightly")] +pub use shio_macros::{get, post}; + /// Re-exports important traits and types. Meant to be glob imported when using Shio. pub mod prelude { pub use super::{header, Context, Method, Request, Response, Shio, StatusCode}; @@ -37,4 +44,7 @@ pub mod prelude { pub use futures::{Future, IntoFuture}; pub use ext::{BoxFuture, FutureExt}; + + #[cfg(feature = "nightly")] + pub use shio_macros::{get, post}; } diff --git a/shio-macro/Cargo.toml b/macros/Cargo.toml similarity index 90% rename from shio-macro/Cargo.toml rename to macros/Cargo.toml index df4af95..5e07573 100644 --- a/shio-macro/Cargo.toml +++ b/macros/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "shio-macro" +name = "shio_macros" version = "0.1.0" authors = ["Quentin Laveau "] workspace = ".." diff --git a/shio-macro/src/lib.rs b/macros/src/lib.rs similarity index 100% rename from shio-macro/src/lib.rs rename to macros/src/lib.rs