cidr_util 0.1.0

A utility for calculation between Ipv4Addr/u32 and CIDR
Documentation
  • Coverage
  • 33.33%
    2 out of 6 items documented0 out of 5 items with examples
  • Size
  • Source code size: 3.39 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.16 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • xmh0511/cidr_util
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • xmh0511

Example

use cidr_util::{Cidr, CidrPrefix};

fn main(){
    assert_eq!(24, Ipv4Addr::new(255, 255, 255, 0).to_prefix_len());
    assert_eq!(
        (Ipv4Addr::new(10, 0, 0, 0), Ipv4Addr::new(10, 0, 0, 255)),
        Ipv4Addr::new(10, 0, 0, 0).ip_range(24)
    );
    assert_eq!(24.to_subnet_mask(), Ipv4Addr::new(255, 255, 255, 0));
    assert_eq!(1.to_subnet_mask(), Ipv4Addr::new(128, 0, 0, 0));
}