1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 19:34:24 +02:00

refactor: make Ironbar#unique_id must_use

This commit is contained in:
Jake Stanger 2024-05-18 16:22:02 +01:00
parent dedb89bb02
commit a0cb01ae5f
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61

View file

@ -239,6 +239,7 @@ impl Ironbar {
/// Gets a `usize` ID value that is unique to the entire Ironbar instance. /// Gets a `usize` ID value that is unique to the entire Ironbar instance.
/// This is just a static `AtomicUsize` that increments every time this function is called. /// This is just a static `AtomicUsize` that increments every time this function is called.
#[must_use]
pub fn unique_id() -> usize { pub fn unique_id() -> usize {
static COUNTER: AtomicUsize = AtomicUsize::new(1); static COUNTER: AtomicUsize = AtomicUsize::new(1);
COUNTER.fetch_add(1, Ordering::Relaxed) COUNTER.fetch_add(1, Ordering::Relaxed)