pub enum ClientId {
Fixed(usize),
RandomRange(Range<usize>),
}Expand description
Strategy for assigning client IDs to workload instances.
Inspired by FoundationDB’s WorkloadContext.clientId, but more
programmable. The resolved client ID is available via
SimContext::client_id().
§Examples
ⓘ
// FDB-style sequential: IDs 0, 1, 2
ClientId::Fixed(0)
// Sequential starting from 10: IDs 10, 11, 12
ClientId::Fixed(10)
// Random IDs in [100..200) per instance
ClientId::RandomRange(100..200)Variants§
Fixed(usize)
Sequential IDs starting from base: instance 0 gets base,
instance 1 gets base + 1, and so on.
RandomRange(Range<usize>)
Random ID drawn from [start..end) per instance,
using the simulation RNG (deterministic per seed).
IDs are not guaranteed unique across instances.
Trait Implementations§
impl StructuralPartialEq for ClientId
Auto Trait Implementations§
impl Freeze for ClientId
impl RefUnwindSafe for ClientId
impl Send for ClientId
impl Sync for ClientId
impl Unpin for ClientId
impl UnsafeUnpin for ClientId
impl UnwindSafe for ClientId
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