Skip to content

Commit ee7d553

Browse files
committed
remove dependency to cmd_lib_core
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>
1 parent 3707d59 commit ee7d553

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ edition = "2018"
1515
[dependencies]
1616
cmd_lib_core = { version = "0.1", path = "crates/cmd_lib_core" }
1717
cmd_lib_macros = { version = "0.1", path = "crates/proc_macros" }
18+
proc-macro-crate = "0.1.5"

src/lib.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
use cmd_lib_core;
2-
use cmd_lib_macros;
1+
pub use cmd_lib_core;
2+
pub use cmd_lib_macros;
33

4-
pub use cmd_lib_macros::{
5-
run_cmd,
6-
run_fun,
7-
};
4+
#[macro_export]
5+
macro_rules! run_cmd {
6+
($($cur:tt)*) => {{
7+
use $crate::cmd_lib_core;
8+
$crate::cmd_lib_macros::run_cmd!($($cur)*)
9+
}};
10+
}
11+
12+
#[macro_export]
13+
macro_rules! run_fun {
14+
($($cur:tt)*) => {{
15+
use $crate::cmd_lib_core;
16+
$crate::cmd_lib_macros::run_fun!($($cur)*)
17+
}};
18+
}
819

920
pub use cmd_lib_core::{
1021
run_cmd,

0 commit comments

Comments
 (0)