Thank you! I've updated the post. In fact, in Rust 2018 they did away with extern crate, you no longer need to mark it with macro_use. You can import macros directly from any crate specified in Cargo.toml:
uselazy_static::lazy_static;
Previously you didn't need a use statement, just the extern crate, now there's no extern crate but you DO need the use. I have noticed that RLS will not autofill the macro name as I type it (it tries to suggest LazyStatic), but it will work when compiled!
True enough! Yikes, note to self, these snippets needed a little massaging. In main.rs on GitHub I just went with use log::*; to pull them all in at once.
I'm glad to hear it, despite the hiccups!
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice post. I am following it closely.
This is missing somewhere, as I am unable to otherwise run
lazy_static!
.Thank you! I've updated the post. In fact, in Rust 2018 they did away with
extern crate
, you no longer need to mark it withmacro_use
. You can import macros directly from any crate specified inCargo.toml
:Previously you didn't need a
use
statement, just theextern crate
, now there's noextern crate
but you DO need theuse
. I have noticed that RLS will not autofill the macro name as I type it (it tries to suggest LazyStatic), but it will work when compiled!Great! I think maybe you could use
somewhere as well?
What a great blog-entry. I learned a few things from it. Cheers!
True enough! Yikes, note to self, these snippets needed a little massaging. In main.rs on GitHub I just went with
use log::*;
to pull them all in at once.I'm glad to hear it, despite the hiccups!