Skip to content

Commit

Permalink
remove dependency to cmd_lib_core
Browse files Browse the repository at this point in the history
Programs using the cmd_lib crate requires to include the cmd_lib_core as
the macros are procedural macros which do not yet support $crate as for regular
macros (See rust-lang/rust#54363).

This commit re-export the procedural macros as well as core/macro libraries. It
also makes sure that the cmd_lib_core is not required by a depending crate.

Signed-off-by: Gregory Detal <gregory.detal@tessares.net>
  • Loading branch information
gdetal committed Oct 16, 2020
1 parent 3707d59 commit ee7d553
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ edition = "2018"
[dependencies]
cmd_lib_core = { version = "0.1", path = "crates/cmd_lib_core" }
cmd_lib_macros = { version = "0.1", path = "crates/proc_macros" }
proc-macro-crate = "0.1.5"
23 changes: 17 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
use cmd_lib_core;
use cmd_lib_macros;
pub use cmd_lib_core;
pub use cmd_lib_macros;

pub use cmd_lib_macros::{
run_cmd,
run_fun,
};
#[macro_export]
macro_rules! run_cmd {
($($cur:tt)*) => {{
use $crate::cmd_lib_core;
$crate::cmd_lib_macros::run_cmd!($($cur)*)
}};
}

#[macro_export]
macro_rules! run_fun {
($($cur:tt)*) => {{
use $crate::cmd_lib_core;
$crate::cmd_lib_macros::run_fun!($($cur)*)
}};
}

pub use cmd_lib_core::{
run_cmd,
Expand Down

0 comments on commit ee7d553

Please sign in to comment.