diff --git a/phf/Cargo.toml b/phf/Cargo.toml index 55597ff3..3f0f6c5c 100644 --- a/phf/Cargo.toml +++ b/phf/Cargo.toml @@ -15,6 +15,9 @@ test = false [features] core = ["phf_shared/core"] unicase = ["phf_shared/unicase"] +macros = ["phf_macros"] [dependencies] phf_shared = { version = "=0.7.23", path = "../phf_shared" } + +phf_macros = { version = "0.7.23", optional = true, path = "../phf_macros" } diff --git a/phf/src/lib.rs b/phf/src/lib.rs index 91c296bc..a68442c2 100644 --- a/phf/src/lib.rs +++ b/phf/src/lib.rs @@ -11,6 +11,11 @@ extern crate std as core; extern crate phf_shared; +#[cfg(feature = "macros")] +extern crate phf_macros; + +#[cfg(feature = "phf_macros")] +pub use phf_macros::*; use core::ops::Deref; diff --git a/phf_macros/Cargo.toml b/phf_macros/Cargo.toml index c70fdb15..98c28759 100644 --- a/phf_macros/Cargo.toml +++ b/phf_macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "phf_macros" -version = "0.1.0" +version = "0.7.23" authors = ["Steven Fackler "] edition = "2018" @@ -8,7 +8,7 @@ edition = "2018" proc-macro = true [dependencies] -syn = { version = "0.15", features = ["full", "extra-traits"] } +syn = { version = "0.15", features = ["full"] } quote = "0.6" proc-macro2 = "0.4" @@ -17,4 +17,4 @@ phf_shared = { version = "=0.7.23", path = "../phf_shared" } [dev-dependencies] compiletest_rs = "0.3" -phf = { version = "0.7.23", path = "../phf" } +phf = { version = "0.7.23", path = "../phf", features = ["macros"] } diff --git a/phf_macros/tests/compile-fail/bad-syntax.rs b/phf_macros/tests/compile-fail/bad-syntax.rs index c5206c01..fe953ed2 100644 --- a/phf_macros/tests/compile-fail/bad-syntax.rs +++ b/phf_macros/tests/compile-fail/bad-syntax.rs @@ -1,9 +1,8 @@ #![feature(proc_macro_hygiene)] extern crate phf; -extern crate phf_macros; -use phf_macros::phf_map; +use phf::phf_map; static MAP: phf::Map = phf_map! { Signature:: diff --git a/phf_macros/tests/test.rs b/phf_macros/tests/test.rs index 86260d6f..fe438c51 100644 --- a/phf_macros/tests/test.rs +++ b/phf_macros/tests/test.rs @@ -2,8 +2,7 @@ mod map { use std::collections::{HashMap, HashSet}; - use phf; - use phf_macros::phf_map; + use phf::phf_map; #[allow(dead_code)] static TRAILING_COMMA: phf::Map<&'static str, isize> = phf_map!( @@ -251,8 +250,7 @@ mod map { mod set { use std::collections::HashSet; - use phf; - use phf_macros::phf_set; + use phf::phf_set; #[allow(dead_code)] static TRAILING_COMMA: phf::Set<&'static str> = phf_set! { @@ -310,8 +308,7 @@ mod set { } mod ordered_map { - use phf; - use phf_macros::phf_ordered_map; + use phf::phf_ordered_map; #[allow(dead_code)] static TRAILING_COMMA: phf::OrderedMap<&'static str, isize> = phf_ordered_map!( @@ -434,8 +431,7 @@ mod ordered_map { } mod ordered_set { - use phf; - use phf_macros::phf_ordered_set; + use phf::phf_ordered_set; #[allow(dead_code)] static TRAILING_COMMA: phf::OrderedSet<&'static str> = phf_ordered_set! {