tokio_dbus/message/
serial.rs1use core::fmt;
2use core::num::NonZeroU32;
3
4#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6#[repr(transparent)]
7pub struct Serial(NonZeroU32);
8
9impl Serial {
10 #[cfg(feature = "alloc")]
11 #[inline]
12 pub(crate) fn new(serial: NonZeroU32) -> Self {
13 Self(serial)
14 }
15
16 #[cfg(feature = "alloc")]
17 #[inline]
18 pub(crate) fn get(self) -> u32 {
19 self.0.get()
20 }
21}
22
23impl fmt::Display for Serial {
24 #[inline]
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 fmt::Display::fmt(&self.0, f)
27 }
28}
29
30impl fmt::Debug for Serial {
31 #[inline]
32 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33 fmt::Debug::fmt(&self.0, f)
34 }
35}