Skip to content

Returns an iterator that iterates over all subnet IPs

License

Notifications You must be signed in to change notification settings

rikonaka/subnetwork-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

subnetwork

Returns an iterator that iterates over all subnet IPs.

Rust

Example

use subnetwork::{Ipv4PoolIpv4};

fn main() {
    let ipv4 = Ipv4::from("192.168.1.1").unwrap();
    let ipv4_pool = Ipv4Pool::from("192.168.1.0/24").unwrap();
    for i in ipv4.iter(24) {
        println!("{:?}", i);
    }
    for i in ipv4_pool {
        println!("{:?}", i);
    }
    let ret = ipv4_pool.contain_from_str("192.168.1.200").unwrap();
    assert_eq!(ret, true);
    let ret = ipv4_pool.contain(ipv4);
    assert_eq!(ret, true);

    let ret = ipv4.within_from_str("192.168.1.0/24").unwarp();
    assert_eq!(ret, true);
    let ret = ipv4.within(ipv4_pool);
    assert_eq!(ret, true);
}

Benchmark

You can see how our performance compares to other similar libraries here.

About

Returns an iterator that iterates over all subnet IPs

Resources

License

Stars

Watchers

Forks

Packages

No packages published