DEV Community

Discussion on: Creative Coding in Rust with Nannou

Collapse
 
minigamedev profile image
Mossa

Nice post. I am following it closely.

This is missing somewhere, as I am unable to otherwise run lazy_static!.

#[macro_use]
extern crate lazy_static;
Collapse
 
deciduously profile image
Ben Lovy • Edited

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:

use lazy_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!

Collapse
 
minigamedev profile image
Mossa

Great! I think maybe you could use

use log::{info, trace, warn};

somewhere as well?

What a great blog-entry. I learned a few things from it. Cheers!

Thread Thread
 
deciduously profile image
Ben Lovy • Edited

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