[][src]Struct ipnet::Ipv4Subnets

pub struct Ipv4Subnets { /* fields omitted */ }

An Iterator that generates IPv4 network addresses.

Generates the subnets between the provided start and end IP addresses inclusive of end. Each iteration generates the next network address of the largest valid size it can, while using a prefix lenth not less than min_prefix_len.

Examples

let subnets = Ipv4Subnets::new(
    "10.0.0.0".parse().unwrap(),
    "10.0.0.239".parse().unwrap(),
    26,
);
 
assert_eq!(subnets.collect::<Vec<Ipv4Net>>(), vec![
    "10.0.0.0/26".parse().unwrap(),
    "10.0.0.64/26".parse().unwrap(),
    "10.0.0.128/26".parse().unwrap(),
    "10.0.0.192/27".parse().unwrap(),
    "10.0.0.224/28".parse().unwrap(),
]);

Methods

impl Ipv4Subnets[src]

pub fn new(start: Ipv4Addr, end: Ipv4Addr, min_prefix_len: u8) -> Self[src]

Trait Implementations

impl Clone for Ipv4Subnets[src]

impl Copy for Ipv4Subnets[src]

impl Debug for Ipv4Subnets[src]

impl Eq for Ipv4Subnets[src]

impl From<Ipv4Subnets> for IpSubnets[src]

impl FusedIterator for Ipv4Subnets[src]

impl Hash for Ipv4Subnets[src]

impl Iterator for Ipv4Subnets[src]

type Item = Ipv4Net

The type of the elements being iterated over.

impl Ord for Ipv4Subnets[src]

impl PartialEq<Ipv4Subnets> for Ipv4Subnets[src]

impl PartialOrd<Ipv4Subnets> for Ipv4Subnets[src]

impl StructuralEq for Ipv4Subnets[src]

impl StructuralPartialEq for Ipv4Subnets[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.