Skip to content

Commit

Permalink
Merge pull request #70 from xorgy/atomic-usize-rather-than-atomic-u64…
Browse files Browse the repository at this point in the history
…-cachekey

Use `AtomicUsize` rather than `AtomicU64` in CacheKey.
  • Loading branch information
dfrg authored Nov 7, 2024
2 parents bb8c583 + d9c1a5e commit b1b54cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ pub struct CacheKey(pub(crate) u64);
impl CacheKey {
/// Generates a new cache key.
pub fn new() -> Self {
use core::sync::atomic::{AtomicU64, Ordering};
static KEY: AtomicU64 = AtomicU64::new(1);
Self(KEY.fetch_add(1, Ordering::Relaxed))
use core::sync::atomic::{AtomicUsize, Ordering};
static KEY: AtomicUsize = AtomicUsize::new(1);
Self(KEY.fetch_add(1, Ordering::Relaxed).try_into().unwrap())
}

/// Returns the underlying value of the key.
Expand Down

0 comments on commit b1b54cc

Please sign in to comment.