tlborm
tlborm copied to clipboard
Provide an example where a macro relies on a external crate
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?
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.
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.
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.