Enum cidr::IpInetPair

source ·
pub enum IpInetPair {
    V4(Ipv4InetPair),
    V6(Ipv6InetPair),
}
Expand description

InetPair type representing either a pair of IPv4 host or a pair of IPv6 hosts within a network

Variants§

§

V4(Ipv4InetPair)

IPv4 host within network

§

V6(Ipv6InetPair)

IPv6 host within network

Implementations§

source§

impl IpInetPair

source

pub const fn is_ipv4(&self) -> bool

Whether representing an IPv4 network

source

pub const fn is_ipv6(&self) -> bool

Whether representing an IPv6 network

source

pub const fn new(first: IpInet, second: IpInet) -> Result<Self, InetTupleError>

Create new pair from two addresses in the same network

Fails if the addresses are not in the same network.

source

pub const fn new_from_addresses( first: IpAddr, second: IpAddr, 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.

source

pub const fn first(&self) -> IpInet

First address

source

pub const fn second(&self) -> IpInet

Second address

source

pub const fn network(&self) -> IpCidr

network (i.e. drops the host information)

source

pub const fn network_length(&self) -> u8

length in bits of the shared prefix of the contained addresses

source

pub const fn family(&self) -> Family

IP family of the contained address (Ipv4 or Ipv6).

source

pub const fn iter(self) -> InetIterator<IpAddr>

Iterate over first..=second (inclusive)

Trait Implementations§

source§

impl Clone for IpInetPair

source§

fn clone(&self) -> IpInetPair

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IpInetPair

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for IpInetPair

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Ipv4InetPair> for IpInetPair

source§

fn from(c: Ipv4InetPair) -> Self

Converts to this type from the input type.
source§

impl From<Ipv6InetPair> for IpInetPair

source§

fn from(c: Ipv6InetPair) -> Self

Converts to this type from the input type.
source§

impl Hash for IpInetPair

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl InetPair for IpInetPair

§

type Address = IpAddr

Type for the underlying address (IpAddr, Ipv4Addr or Ipv6Addr).
source§

fn new(first: IpInet, second: IpInet) -> Result<Self, InetTupleError>

Create new pair from two addresses in the same network Read more
source§

fn new_from_addresses( first: IpAddr, second: IpAddr, len: u8 ) -> Result<Self, InetTupleError>

Create new pair from two addresses and a common length Read more
source§

fn first(&self) -> IpInet

First address
source§

fn second(&self) -> IpInet

Second address
source§

fn network(&self) -> IpCidr

network (i.e. drops the host information)
source§

fn network_length(&self) -> u8

length in bits of the shared prefix of the contained addresses
source§

fn family(&self) -> Family

IP family of the contained address (Ipv4 or Ipv6).
source§

fn iter(self) -> InetIterator<IpAddr>

Iterate over first..=second (inclusive)
source§

impl IntoIterator for IpInetPair

§

type IntoIter = InetIterator<IpAddr>

Which kind of iterator are we turning this into?
§

type Item = IpInet

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<IpInetPair> for IpInetPair

source§

fn eq(&self, other: &IpInetPair) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for IpInetPair

source§

impl Eq for IpInetPair

source§

impl StructuralEq for IpInetPair

source§

impl StructuralPartialEq for IpInetPair

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.