net_wire/icmpv4/types.rs
1/// An ICMPv4 message type, preserving unknown values.
2#[repr(transparent)]
3#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
4pub struct Icmpv4Type(u8);
5
6impl Icmpv4Type {
7 /// Echo Reply (`0`).
8 pub const ECHO_REPLY: Self = Self(0);
9 /// Destination Unreachable (`3`).
10 pub const DESTINATION_UNREACHABLE: Self = Self(3);
11 /// Echo Request (`8`).
12 pub const ECHO_REQUEST: Self = Self(8);
13 /// Time Exceeded (`11`).
14 pub const TIME_EXCEEDED: Self = Self(11);
15 /// Constructs a raw type value.
16 pub const fn new(raw: u8) -> Self {
17 Self(raw)
18 }
19 /// Returns the raw type value.
20 pub const fn raw(self) -> u8 {
21 self.0
22 }
23}