Hacker News new | ask | show | jobs
by umanwizard 188 days ago
OP here, not showing how to declare the variable was an oversight on my part.

  static mut COUNTER: u32 = 0;
(at top-level)

If on 2024 edition, you will additionally need

  #![allow(static_mut_refs)]
1 comments

Yup, your example was fine, as I said I just wanted to show a safe method too :-)