pub struct FastIdGenerator { /* private fields */ }
Expand description
An IdGenerator
implementation optimized for lightweight, locally-scoped identifiers.
This generator produces short, incrementing identifiers that are Base64-encoded.
This makes it well-suited for cases such as StreamId
generation, where:
- IDs only need to be unique within a single process or session
- Predictability is acceptable
- Shorter, more human-readable identifiers are desirable
Implementations§
Trait Implementations§
Source§impl<T> IdGenerator<T> for FastIdGenerator
impl<T> IdGenerator<T> for FastIdGenerator
Source§fn generate(&self) -> T
fn generate(&self) -> T
Generates a new session ID as a short Base64-encoded string.
Increments an internal counter atomically and encodes it in Base64 URL-safe format. The resulting ID is prefixed (if provided) and typically 8–12 characters long.
§Returns
SessionId
- A short, unique session ID (e.g., “sid_BBBB” or “BBBB”).
Auto Trait Implementations§
impl !Freeze for FastIdGenerator
impl RefUnwindSafe for FastIdGenerator
impl Send for FastIdGenerator
impl Sync for FastIdGenerator
impl Unpin for FastIdGenerator
impl UnwindSafe for FastIdGenerator
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