Crates.io | eat-nom |
lib.rs | eat-nom |
version | 0.1.5 |
source | src |
created_at | 2020-04-12 11:27:04.684255 |
updated_at | 2020-07-20 05:43:33.134331 |
description | A tools about normal domain extend use nom |
homepage | |
repository | https://github.com/baoyachi/eat-nom.git |
max_upload_size | |
id | 229062 |
size | 11,763 |
eat nom based on nom. A tools about normal domain extend use nom
extern crate eat_nom;
use eat_nom::ip::parse_ip_mask;
use std::net::Ipv4Addr;
fn main() {
let ip_mask = "127.0.0.1/255.0.255.0";
let (ip, mask) = parse_ip_mask(ip_mask, "/").unwrap();
assert_eq!(ip, Ipv4Addr::new(127, 0, 0, 1));
assert_eq!(mask, Ipv4Addr::new(255, 0, 255, 0));
}
extern crate eat_nom;
use eat_nom::ip::parse_ip_mask_opt;
use std::net::Ipv4Addr;
fn main() {
let ip_mask = "127.0.0.1/255.0.255.0";
let (ip, mask) = parse_ip_mask_opt(ip_mask).unwrap();
assert_eq!(ip, Ipv4Addr::new(127, 0, 0, 1));
assert_eq!(mask, Ipv4Addr::new(255, 0, 255, 0));
}