INNER CODE UNIT · Rust
default
ekzhang/sshx · crates/sshx-core/src/lib.rs:61
fn default() -> Self {
Self {
next_sid: AtomicU32::new(1),
next_uid: AtomicU32::new(1),
}
}
}
impl IdCounter {
/// Returns the next unique shell ID.
pub fn next_sid(&self) -> Sid {
Sid(self.next_sid.fetch_add(1, Ordering::Relaxed))
}
/// Returns the next unique user ID.
pub fn next_uid(&self) -> Uid {
Uid(self.next_uid.fetch_add(1, Ordering::Relaxed))
}