pub struct KeyGenerator32<K: From<u32> + Into<u32> + Copy> { /* private fields */ }Expand description
u32 variant of crate::KeyGenerator — same recycling semantics, wider
key space. Forked rather than generic-ified to keep the existing u16
generator’s call sites untouched.
Implementations§
Source§impl<K: From<u32> + Into<u32> + Copy> KeyGenerator32<K>
impl<K: From<u32> + Into<u32> + Copy> KeyGenerator32<K>
Sourcepub fn new(recycle_timeout: Duration) -> Self
pub fn new(recycle_timeout: Duration) -> Self
Creates a generator that quarantines recycled keys for at least recycle_timeout before reissuing them.
Sourcepub fn generate(&mut self) -> K
pub fn generate(&mut self) -> K
Issues the next available key, preferring recycled keys whose quarantine period has elapsed.
Sourcepub fn recycle_key(&mut self, key: &K)
pub fn recycle_key(&mut self, key: &K)
Marks key as available for reuse after the configured quarantine period expires.
Sourcepub fn capacity_hint(&self) -> u32
pub fn capacity_hint(&self) -> u32
Highest index ever issued + 1. Used to size bit-vec storage in Stage B.
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for KeyGenerator32<K>
impl<K> RefUnwindSafe for KeyGenerator32<K>where
K: RefUnwindSafe,
impl<K> Send for KeyGenerator32<K>where
K: Send,
impl<K> Sync for KeyGenerator32<K>where
K: Sync,
impl<K> Unpin for KeyGenerator32<K>where
K: Unpin,
impl<K> UnsafeUnpin for KeyGenerator32<K>
impl<K> UnwindSafe for KeyGenerator32<K>where
K: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more