1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::traits::Afi;

/// An IP address of address family `A`.
#[derive(Clone, Copy, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct Address<A: Afi>(A::Primitive);

impl<A: Afi> Address<A> {
    /// Construct a new [`Address<A>`] from an integer primitive
    /// appropriate to `A`.
    pub const fn new(inner: A::Primitive) -> Self {
        Self(inner)
    }

    /// Get the primitive integer value, consuming `self`.
    pub const fn into_primitive(self) -> A::Primitive {
        self.0
    }
}