Skip to content

Instantly share code, notes, and snippets.

@panicbit
Created December 25, 2017 02:38
Show Gist options
  • Save panicbit/e166d20151b7d6a3979404f4618a980f to your computer and use it in GitHub Desktop.
Save panicbit/e166d20151b7d6a3979404f4618a980f to your computer and use it in GitHub Desktop.
extern crate cidr;
extern crate bitstring;
use cidr::{Ipv4Cidr,Cidr};
use bitstring::BitString;
fn main() {
let ip = "10.61.3.123".parse().unwrap();
let mut net = Ipv4Cidr::new_host(ip);
net.clip(24);
println!("{}", net);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment