tlborm icon indicating copy to clipboard operation
tlborm copied to clipboard

Provide an example where a macro relies on a external crate

Open dvberkel opened this issue 9 years ago • 3 comments
trafficstars

In the Rust Community forum there is a question on how to make a external crate work in a macro.

Unresolved import; can’t find crate/modules in macro no matter what I do

You answered that question. I am having similar issues getting a macro to work. Specifically I would like to use the gen_range method from the rand crate. I am in the processof following your advice, putting together all the pieces to see if I can make it work.

Would it be interesting to include an example of a macro that uses an external crate in the little book of rust macros?

dvberkel avatar Mar 08 '16 11:03 dvberkel

Following your advice I made a macro that uses a external crate. If you are interested I could write up my experience as a pull request.

dvberkel avatar Mar 09 '16 13:03 dvberkel

Seems like a good idea for the import/export section. One thing I'm a little leery about, however, is that I've started getting "this will be a hard error in future" warnings on the trick I use to do this... so I'll need to sort out what's going on first.

DanielKeep avatar Mar 11 '16 05:03 DanielKeep

I would want to pass along work that I am interested in on to you, but I am no expert. If there is anything I can do to help, just let me know.

dvberkel avatar Mar 11 '16 08:03 dvberkel