context_async/name.rs
1use std::fmt::{Display, Formatter};
2
3#[derive(Debug, Clone, Copy)]
4pub struct Name(u64);
5
6impl Default for Name {
7 fn default() -> Self {
8 Self(rand::random())
9 }
10}
11
12impl Display for Name {
13 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
14 f.write_str(&self.0.to_string())
15 }
16}
17
18impl Name {
19 #[inline]
20 pub fn as_u64(&self) -> u64 {
21 self.0
22 }
23}