pub struct IdSeqUsizeExample { /* private fields */ }doc or test only.Expand description
✨ 🏗️
A unique sequential identifier usize generator.
The counter starts at usize::MIN + 1,
and increments with each new identifier generated.
The implementation guards against wrap-around
after usize::MAX,
by returning None in the checked methods, or panicking in the unchecked methods.
See also the id_seq macro.
Implementations§
Source§impl IdSeqUsizeExample
impl IdSeqUsizeExample
Sourcepub fn new_unchecked() -> Self
pub fn new_unchecked() -> Self
Generates some unique IdSeqUsizeExample ID.
Alias of new_balanced_unchecked.
§Panics
Panics on overflow.
Sourcepub fn new_strong() -> Option<Self> ⓘ
pub fn new_strong() -> Option<Self> ⓘ
Generates some unique IdSeqUsizeExample ID with SeqCst ordering.
Ensures the strongest memory consistency across all threads, even at the cost of performance.
Returns None on overflow.
Sourcepub fn new_strong_unchecked() -> Self
pub fn new_strong_unchecked() -> Self
Sourcepub fn new_balanced() -> Option<Self> ⓘ
pub fn new_balanced() -> Option<Self> ⓘ
Generates some unique IdSeqUsizeExample ID with AcqRel ordering.
Balances performance and memory safety, ensuring consistent visibility across threads.
Returns None on overflow.
Sourcepub fn new_balanced_unchecked() -> Self
pub fn new_balanced_unchecked() -> Self
Sourcepub fn new_fast() -> Option<Self> ⓘ
pub fn new_fast() -> Option<Self> ⓘ
Generates some unique IdSeqUsizeExample ID with Relaxed ordering.
Offers maximum performance in low-contention scenarios where memory ordering is not a concern.
Returns None on overflow.
Sourcepub fn new_fast_unchecked() -> Self
pub fn new_fast_unchecked() -> Self
Sourcepub fn iter_strong() -> impl Iterator<Item = IdSeqUsizeExample>
pub fn iter_strong() -> impl Iterator<Item = IdSeqUsizeExample>
Iterator over generated IDs with SeqCst ordering.
Ensures the strongest memory consistency across all threads, even at the cost of performance.
Sourcepub fn iter_strong_unchecked() -> impl Iterator<Item = IdSeqUsizeExample>
pub fn iter_strong_unchecked() -> impl Iterator<Item = IdSeqUsizeExample>
Iterator over generated IDs with SeqCst ordering.
Ensures the strongest memory consistency across all threads, even at the cost of performance.
§Panics
Panics on overflow.
Sourcepub fn iter_balanced() -> impl Iterator<Item = IdSeqUsizeExample>
pub fn iter_balanced() -> impl Iterator<Item = IdSeqUsizeExample>
Iterator over generated IDs with AcqRel ordering.
Balances performance and memory safety, ensuring consistent visibility across threads.
Sourcepub fn iter_balanced_unchecked() -> impl Iterator<Item = IdSeqUsizeExample>
pub fn iter_balanced_unchecked() -> impl Iterator<Item = IdSeqUsizeExample>
Iterator over generated IDs with AcqRel ordering.
Balances performance and memory safety, ensuring consistent visibility across threads.
§Panics
Panics on overflow.
Sourcepub fn iter_fast() -> impl Iterator<Item = IdSeqUsizeExample>
pub fn iter_fast() -> impl Iterator<Item = IdSeqUsizeExample>
Iterator over generated IDs with Relaxed ordering.
Offers maximum performance in low-contention scenarios where memory ordering is not a concern.
Sourcepub fn iter_fast_unchecked() -> impl Iterator<Item = IdSeqUsizeExample>
pub fn iter_fast_unchecked() -> impl Iterator<Item = IdSeqUsizeExample>
Iterator over generated IDs with Relaxed ordering.
Offers maximum performance in low-contention scenarios where memory ordering is not a concern.
§Panics
Panics on overflow.
Sourcepub fn value(&self) -> usize
pub fn value(&self) -> usize
Returns the underlying unique ID value
as a usize.
The value is guaranteed to be a valid sequential identifier, from
usize::MIN to usize::MAX.
Sourcepub fn generated_ids() -> usize
pub fn generated_ids() -> usize
Returns the number of IDs generated so far.
Alias of generated_ids_balanced.
Sourcepub fn generated_ids_strong() -> usize
pub fn generated_ids_strong() -> usize
Returns the number of IDs generated so far with SeqCst ordering.
Ensures the strongest memory consistency across all threads, even at the cost of performance.
Sourcepub fn generated_ids_balanced() -> usize
pub fn generated_ids_balanced() -> usize
Returns the number of IDs generated so far with Acquire ordering.
Balances performance and memory safety, ensuring consistent visibility across threads.
Sourcepub fn generated_ids_fast() -> usize
pub fn generated_ids_fast() -> usize
Returns the number of IDs generated so far with Relaxed ordering.
Offers maximum performance in low-contention scenarios where memory ordering is not a concern.
Sourcepub fn remaining_ids() -> usize
pub fn remaining_ids() -> usize
Returns the number of remaining IDs.
Alias of remaining_ids_balanced.
Sourcepub fn remaining_ids_strong() -> usize
pub fn remaining_ids_strong() -> usize
Returns the number of remaining IDs with SeqCst ordering.
Ensures the strongest memory consistency across all threads, even at the cost of performance.
Sourcepub fn remaining_ids_balanced() -> usize
pub fn remaining_ids_balanced() -> usize
Returns the number of remaining IDs with Acquire ordering.
Balances performance and memory safety, ensuring consistent visibility across threads.
Sourcepub fn remaining_ids_fast() -> usize
pub fn remaining_ids_fast() -> usize
Returns the number of remaining IDs with Relaxed ordering.
Offers maximum performance in low-contention scenarios where memory ordering is not a concern.
Trait Implementations§
Source§impl Debug for IdSeqUsizeExample
impl Debug for IdSeqUsizeExample
impl Eq for IdSeqUsizeExample
Source§impl From<IdSeqUsizeExample> for usize
impl From<IdSeqUsizeExample> for usize
Source§fn from(from: IdSeqUsizeExample) -> usize
fn from(from: IdSeqUsizeExample) -> usize
Source§impl Hash for IdSeqUsizeExample
impl Hash for IdSeqUsizeExample
Source§impl Ord for IdSeqUsizeExample
impl Ord for IdSeqUsizeExample
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for IdSeqUsizeExample
impl PartialEq for IdSeqUsizeExample
Source§impl PartialOrd for IdSeqUsizeExample
impl PartialOrd for IdSeqUsizeExample
Auto Trait Implementations§
impl Freeze for IdSeqUsizeExample
impl RefUnwindSafe for IdSeqUsizeExample
impl Send for IdSeqUsizeExample
impl Sync for IdSeqUsizeExample
impl Unpin for IdSeqUsizeExample
impl UnsafeUnpin for IdSeqUsizeExample
impl UnwindSafe for IdSeqUsizeExample
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice only.