pub struct CounterIds { /* private fields */ }Expand description
A counter-based generator: <prefix><counter>, base-36 encoded.
For targets with no entropy source. It satisfies Part 4 §4.1.4 only if the prefix is different on every boot — a persisted boot counter, a serial number plus a session number, anything that does not repeat. With a constant prefix the ids restart at zero after a power cut and collide with the ones used before it, which is exactly what §4.1.4 forbids and what makes a CSMS mismatch a response to the wrong request.
A Local Controller uses the prefix for a second purpose: keeping its own ids disjoint from the CSMS’s (Part 4 §6.4).
Implementations§
Source§impl CounterIds
impl CounterIds
Sourcepub fn with_prefix(prefix: impl Into<String>) -> Self
pub fn with_prefix(prefix: impl Into<String>) -> Self
Starts a generator with the given prefix. Read the type’s documentation first: the prefix is what makes the ids unique across reboots.
Trait Implementations§
Source§impl Clone for CounterIds
impl Clone for CounterIds
Source§impl Debug for CounterIds
impl Debug for CounterIds
Source§impl Default for CounterIds
impl Default for CounterIds
Source§impl IdGenerator for CounterIds
impl IdGenerator for CounterIds
Auto Trait Implementations§
impl Forget for CounterIds
impl Freeze for CounterIds
impl Move for CounterIds
impl RefUnwindSafe for CounterIds
impl Send for CounterIds
impl Sync for CounterIds
impl Unpin for CounterIds
impl UnsafeUnpin for CounterIds
impl UnwindSafe for CounterIds
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