pub struct ExampleIdSeqUsize { /* 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 ExampleIdSeqUsize
impl ExampleIdSeqUsize
Sourcepub fn new_unchecked() -> Self
pub fn new_unchecked() -> Self
Generates some unique ExampleIdSeqUsize 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 ExampleIdSeqUsize 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 ExampleIdSeqUsize 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 ExampleIdSeqUsize 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 = ExampleIdSeqUsize>
pub fn iter_strong() -> impl Iterator<Item = ExampleIdSeqUsize>
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 = ExampleIdSeqUsize>
pub fn iter_strong_unchecked() -> impl Iterator<Item = ExampleIdSeqUsize>
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 = ExampleIdSeqUsize>
pub fn iter_balanced() -> impl Iterator<Item = ExampleIdSeqUsize>
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 = ExampleIdSeqUsize>
pub fn iter_balanced_unchecked() -> impl Iterator<Item = ExampleIdSeqUsize>
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 = ExampleIdSeqUsize>
pub fn iter_fast() -> impl Iterator<Item = ExampleIdSeqUsize>
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 = ExampleIdSeqUsize>
pub fn iter_fast_unchecked() -> impl Iterator<Item = ExampleIdSeqUsize>
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 ExampleIdSeqUsize
impl Debug for ExampleIdSeqUsize
Source§impl From<ExampleIdSeqUsize> for usize
impl From<ExampleIdSeqUsize> for usize
Source§fn from(from: ExampleIdSeqUsize) -> usize
fn from(from: ExampleIdSeqUsize) -> usize
Source§impl Hash for ExampleIdSeqUsize
impl Hash for ExampleIdSeqUsize
Source§impl Ord for ExampleIdSeqUsize
impl Ord for ExampleIdSeqUsize
Source§impl PartialEq for ExampleIdSeqUsize
impl PartialEq for ExampleIdSeqUsize
Source§impl PartialOrd for ExampleIdSeqUsize
impl PartialOrd for ExampleIdSeqUsize
impl Eq for ExampleIdSeqUsize
Auto Trait Implementations§
impl Freeze for ExampleIdSeqUsize
impl RefUnwindSafe for ExampleIdSeqUsize
impl Send for ExampleIdSeqUsize
impl Sync for ExampleIdSeqUsize
impl Unpin for ExampleIdSeqUsize
impl UnwindSafe for ExampleIdSeqUsize
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
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<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny 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§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem 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.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more