port-plumber 0.2.1

Utility bind ports with initialization commands
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::net::{IpAddr, Ipv4Addr};

pub trait Increment: Sized {
    fn increment(&mut self) -> Self;
}

impl Increment for IpAddr {
    fn increment(&mut self) -> Self {
        match self {
            IpAddr::V4(ipv4) => {
                let value = u32::from(*ipv4) + 1;
                *self = Self::from(Ipv4Addr::from(value));
                self.clone()
            },
            IpAddr::V6(_) => unimplemented!(),
        }
    }
}