network/
service.rs

1use core::fmt::Display;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
4#[repr(transparent)]
5pub struct Port(u16);
6
7impl Port {
8    pub const ANY: Self = Self(0);
9
10    pub const fn new(value: u16) -> Self {
11        Self(value)
12    }
13
14    pub const fn into_inner(self) -> u16 {
15        self.0
16    }
17
18    pub const fn from_inner(value: u16) -> Self {
19        Self(value)
20    }
21}
22
23impl Display for Port {
24    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
25        write!(f, "{}", self.0)
26    }
27}