quicli icon indicating copy to clipboard operation
quicli copied to clipboard

Can't use `debug!()` in mod

Open bestouff opened this issue 7 years ago • 1 comments

Hi,

I've created an executable with 2 files, used #[macro_use] extern crate quicli; and use quicli::prelude::*; in the first one but now I can't use debug!() in the second one:

error: cannot find macro `debug!` in this scope
  --> src/endmi.rs:28:9
   |
28 |         debug!("start decoding");
   |         ^^^^^

error: aborting due to previous error

I've tried adding use quicli::prelude::*; in the second file, but now some types are polluted (e.g. Result takes only 1 arg now, I guess io::Result has shadowed result::Result).

Is that intended behavior ? Or do I have to do something to have log macros available short of reimporting the log crate ?

bestouff avatar Feb 02 '18 08:02 bestouff

Interesting! Using the glob import to import macros is sadly a bit of a hack right now. Seems like this may be its limit? You seem to need to import the macros again but I don't think that's possible without using *.

Quicli exposes a Result that has its error case set to failure's Error. If that's not okay for you (it's much more generic than io::Result), you can use std::result::Result :)

(I've been thinking of removing the result alias btw.)

Xavier Bestel [email protected] schrieb am Fr. 2. Feb. 2018 um 09:49:

Hi,

I've created an executable with 2 files, used #[macro_use] extern crate quicli; and use quicli::prelude::*; in the first one but now I can't use debug!() in the second one:

error: cannot find macro debug! in this scope --> src/endmi.rs:28:9 | 28 | debug!("start decoding"); | ^^^^^

error: aborting due to previous error

I've tried adding use quicli::prelude::*; in the second file, but now some types are polluted (e.g. Result takes only 1 arg now, I guess io::Result has shadowed result::Result).

Is that intended behavior ? Or do I have to do something to have log macros available short of reimporting the log crate ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/killercup/quicli/issues/39, or mute the thread https://github.com/notifications/unsubscribe-auth/AABOX_G9DKOpYZQ3UijOrHIso100Tr_rks5tQswngaJpZM4R22-c .

killercup avatar Feb 02 '18 10:02 killercup