Skip to main content

net_wire/ipv4/
address.rs

1/// A four-octet IPv4 address in wire order.
2#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
3pub struct Ipv4Address([u8; 4]);
4
5impl Ipv4Address {
6    /// Constructs an address from wire-order octets.
7    #[inline]
8    pub const fn new(octets: [u8; 4]) -> Self {
9        Self(octets)
10    }
11
12    /// Returns wire-order octets.
13    #[inline]
14    pub const fn octets(self) -> [u8; 4] {
15        self.0
16    }
17}