Skip to main content

stylex_enums/
counter_mode.rs

1/// Counter mode for UidGenerator
2#[derive(Clone, Debug)]
3pub enum CounterMode {
4  /// Use global counters shared across all instances (default behavior).
5  /// This ensures unique identifiers across the entire application.
6  _Global,
7  /// Use local counters specific to each instance (legacy behavior).
8  /// Each UidGenerator instance maintains its own counter, which can lead to
9  /// duplicate identifiers across different instances with the same prefix.
10  Local,
11  /// Use thread-local counters for test isolation.
12  /// Each thread gets its own set of counters, perfect for parallel testing.
13  ThreadLocal,
14  /// Use a combination of thread ID and prefix for maximum uniqueness.
15  /// This mode uses thread ID as part of the identifier generation.
16  _ThreadUnique,
17}