neco_server_core/
status.rs1#[derive(Clone, Copy, Debug, PartialEq, Eq)]
3pub struct StatusCode(u16);
4
5impl StatusCode {
6 pub const OK: Self = Self(200);
8 pub const BAD_REQUEST: Self = Self(400);
10 pub const UNAUTHORIZED: Self = Self(401);
12 pub const NOT_FOUND: Self = Self(404);
14 pub const METHOD_NOT_ALLOWED: Self = Self(405);
16 pub const INTERNAL_SERVER_ERROR: Self = Self(500);
18
19 pub const fn from_u16(value: u16) -> Self {
21 Self(value)
22 }
23
24 pub const fn as_u16(self) -> u16 {
26 self.0
27 }
28}