Struct cidr::Ipv4InetPair

source ·
pub struct Ipv4InetPair { /* private fields */ }
Expand description

InetPair type representing a pair of IPv4 hosts within a network

Implementations§

source§

impl Ipv4InetPair

source

pub const fn new( first: Ipv4Inet, second: Ipv4Inet ) -> 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: Ipv4Addr, second: Ipv4Addr, 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) -> Ipv4Inet

First address

source

pub const fn second(&self) -> Ipv4Inet

Second address

source

pub const fn network(&self) -> Ipv4Cidr

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<Ipv4Addr>

Iterate over first..=second (inclusive)

Trait Implementations§

source§

impl Clone for Ipv4InetPair

source§

fn clone(&self) -> Ipv4InetPair

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 Ipv4InetPair

source§

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

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

impl Display for Ipv4InetPair

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 Hash for Ipv4InetPair

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 Ipv4InetPair

§

type Address = Ipv4Addr

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

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

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

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 Read more
source§

fn first(&self) -> Ipv4Inet

First address
source§

fn second(&self) -> Ipv4Inet

Second address
source§

fn network(&self) -> Ipv4Cidr

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<Ipv4Addr>

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

impl IntoIterator for Ipv4InetPair

Iterate over all the addresses in the CIDR.

§

type IntoIter = InetIterator<Ipv4Addr>

Which kind of iterator are we turning this into?
§

type Item = Ipv4Inet

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<Ipv4InetPair> for Ipv4InetPair

source§

fn eq(&self, other: &Ipv4InetPair) -> 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 Ipv4InetPair

source§

impl Eq for Ipv4InetPair

source§

impl StructuralEq for Ipv4InetPair

source§

impl StructuralPartialEq for Ipv4InetPair

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.