Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature gate derive for re-exporting proc macros to strum. #57

Merged
merged 1 commit into from Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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