1#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
6pub struct StatusCode(pub u8);
7
8impl StatusCode {
9 pub const SUCCESS: Self = Self(0);
11 pub const NOT_INTERESTED: Self = Self(1);
12 pub const REQUEST_DENIED: Self = Self(2);
13 pub const INCONSISTENT_DATA: Self = Self(3);
14
15 pub const UNKNOWN_MESSAGE: Self = Self(128);
17 pub const UNEXPECTED_MESSAGE: Self = Self(129);
18 pub const INVALID_DATA: Self = Self(130);
19 pub const INVALID_DESTINATION: Self = Self(131);
20 pub const TIMED_OUT: Self = Self(132);
21 pub const SHUTTING_DOWN: Self = Self(255);
22
23 pub const fn terminates_session(self) -> bool {
24 self.0 >= 128
25 }
26}
27
28impl From<u8> for StatusCode {
29 fn from(v: u8) -> Self {
30 Self(v)
31 }
32}