pub enum Backoff {
Spin,
Yield,
Sleep,
}Available on crate features
ulid and thread-local only.Expand description
Backoff strategies for handling monotonic ULID overflow.
If multiple ULIDs are generated in the same millisecond and the random component is exhausted, the generator invokes one of these strategies to wait before retrying.
Variants§
Spin
Busy-waits in a tight loop.
Offers maximum throughput at the cost of high CPU usage.
Yield
Yields to the OS scheduler to allow other threads to run.
More CPU-friendly than spinning, but may still busy-wait if no other threads are ready.
Sleep
Sleeps for the requested retry delay in milliseconds.
Lowest CPU usage, but may oversleep depending on platform-specific scheduler resolution.
Trait Implementations§
impl Copy for Backoff
Available on crate features
snowflake or ulid only.Auto Trait Implementations§
impl Freeze for Backoff
impl RefUnwindSafe for Backoff
impl Send for Backoff
impl Sync for Backoff
impl Unpin for Backoff
impl UnwindSafe for Backoff
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