Skip to main content

net_wire/icmpv6/
types.rs

1/// An ICMPv6 message type, preserving unknown values.
2#[repr(transparent)]
3#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
4pub struct Icmpv6Type(u8);
5
6impl Icmpv6Type {
7    /// Destination Unreachable (`1`).
8    pub const DESTINATION_UNREACHABLE: Self = Self(1);
9    /// Packet Too Big (`2`).
10    pub const PACKET_TOO_BIG: Self = Self(2);
11    /// Time Exceeded (`3`).
12    pub const TIME_EXCEEDED: Self = Self(3);
13    /// Parameter Problem (`4`).
14    pub const PARAMETER_PROBLEM: Self = Self(4);
15    /// Echo Request (`128`).
16    pub const ECHO_REQUEST: Self = Self(128);
17    /// Echo Reply (`129`).
18    pub const ECHO_REPLY: Self = Self(129);
19
20    /// Constructs a type from its raw wire value.
21    #[inline]
22    pub const fn new(raw: u8) -> Self {
23        Self(raw)
24    }
25
26    /// Returns the raw wire value.
27    #[inline]
28    pub const fn raw(self) -> u8 {
29        self.0
30    }
31}