pub trait InetPair: Copy + Debug + Eq + Hash + PrivInetPair {
type Address: Address<InetPair = Self>;
// Required methods
fn new(
first: <Self::Address as Address>::Inet,
second: <Self::Address as Address>::Inet
) -> Result<Self, InetTupleError>;
fn new_from_addresses(
first: Self::Address,
second: Self::Address,
len: u8
) -> Result<Self, InetTupleError>;
fn first(&self) -> <Self::Address as Address>::Inet;
fn second(&self) -> <Self::Address as Address>::Inet;
fn network(&self) -> <Self::Address as Address>::Cidr;
fn network_length(&self) -> u8;
fn family(&self) -> Family;
fn iter(self) -> InetIterator<Self::Address> ⓘ;
}
Expand description
Pair of two addresses in the same network
Required Associated Types§
Required Methods§
sourcefn new(
first: <Self::Address as Address>::Inet,
second: <Self::Address as Address>::Inet
) -> Result<Self, InetTupleError>
fn new( first: <Self::Address as Address>::Inet, second: <Self::Address as Address>::Inet ) -> Result<Self, InetTupleError>
Create new pair from two addresses in the same network
Fails if the addresses are not in the same network.
sourcefn new_from_addresses(
first: Self::Address,
second: Self::Address,
len: u8
) -> Result<Self, InetTupleError>
fn new_from_addresses( first: Self::Address, second: Self::Address, len: u8 ) -> Result<Self, InetTupleError>
Create new pair from two addresses and a common length
Fails if the network length is invalid for the addresses or the addresses are not in the same network.
sourcefn network(&self) -> <Self::Address as Address>::Cidr
fn network(&self) -> <Self::Address as Address>::Cidr
network (i.e. drops the host information)
sourcefn network_length(&self) -> u8
fn network_length(&self) -> u8
length in bits of the shared prefix of the contained addresses
sourcefn iter(self) -> InetIterator<Self::Address> ⓘ
fn iter(self) -> InetIterator<Self::Address> ⓘ
Iterate over first..=second
(inclusive)