Skip to content

Commit

Permalink
Add feature derive for re-exporting proc macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
uHOOCCOOHu authored and Peternator7 committed Aug 16, 2019
1 parent 640c0bb commit 00397fe
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
8 changes: 7 additions & 1 deletion strum/Cargo.toml
Expand Up @@ -12,8 +12,14 @@ documentation = "https://docs.rs/strum"
homepage = "https://github.com/Peternator7/strum"
readme = "../README.md"

[dependencies]
strum_macros = { path = "../strum_macros", optional = true, version = "0.15.0" }

[dev-dependencies]
strum_macros = { path = "../strum_macros", version = "0.15.0" }

[badges]
travis-ci = { repository = "Peternator7/strum" }
travis-ci = { repository = "Peternator7/strum" }

[features]
derive = ["strum_macros"]
9 changes: 9 additions & 0 deletions strum/src/lib.rs
Expand Up @@ -206,3 +206,12 @@ where
pub trait EnumCount {
fn count() -> usize;
}

#[cfg(feature = "derive")]
#[allow(unused_imports)]
#[macro_use]
extern crate strum_macros;

#[cfg(feature = "derive")]
#[doc(hidden)]
pub use strum_macros::*;
2 changes: 1 addition & 1 deletion strum_tests/Cargo.toml
Expand Up @@ -4,7 +4,7 @@ version = "0.15.0"
authors = ["Peter Glotfelty <peglotfe@microsoft.com>"]

[dependencies]
strum = { path = "../strum" }
strum = { path = "../strum", features = ["derive"] }
strum_macros = { path = "../strum_macros", features = [] }
clap = "2.33.0"
structopt = "0.2.18"
2 changes: 2 additions & 0 deletions strum_tests/src/lib.rs
@@ -1,6 +1,8 @@
#![allow(unused_imports)]
extern crate strum;
#[macro_use]
extern crate strum_macros;
use strum::*;

#[allow(dead_code)]
#[derive(Debug, Eq, PartialEq, EnumString, ToString, EnumCount, EnumDiscriminants)]
Expand Down
1 change: 1 addition & 0 deletions strum_tests/tests/enum_message.rs
@@ -1,3 +1,4 @@
#![allow(unused_imports)]
extern crate strum;
#[macro_use]
extern crate strum_macros;
Expand Down
1 change: 1 addition & 0 deletions strum_tests/tests/enum_props.rs
@@ -1,3 +1,4 @@
#![allow(unused_imports)]
extern crate strum;
#[macro_use]
extern crate strum_macros;
Expand Down

0 comments on commit 00397fe

Please sign in to comment.