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 68e00a1
Showing 1 changed file with 17 additions and 6 deletions.
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 68e00a1

Please sign in to comment.