axum_cometd/types/
client_id.rs1use crate::types::{Id, ZERO_ID};
2use core::fmt::{Debug, Display, Formatter};
3use serde::{Deserialize, Serialize};
4
5pub(crate) const ZERO_CLIENT_ID: ClientId = ClientId(ZERO_ID);
6
7#[derive(Clone, Copy, Hash, Eq, PartialEq, Deserialize, Serialize)]
9pub struct ClientId(Id);
10
11impl ClientId {
12 #[inline(always)]
13 pub(crate) fn gen() -> Self {
14 Self(Id::gen())
15 }
16}
17
18impl Debug for ClientId {
19 fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
20 Debug::fmt(&self.0, f)
21 }
22}
23
24impl Display for ClientId {
25 fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
26 Display::fmt(&self.0, f)
27 }
28}