eat-nom

Crates.ioeat-nom
lib.rseat-nom
version0.1.5
sourcesrc
created_at2020-04-12 11:27:04.684255
updated_at2020-07-20 05:43:33.134331
descriptionA tools about normal domain extend use nom
homepage
repositoryhttps://github.com/baoyachi/eat-nom.git
max_upload_size
id229062
size11,763
(baoyachi)

documentation

README

eat-nom

License Cargo Documentation

eat nom based on nom. A tools about normal domain extend use nom

parse ip

  • parse_ip_mask
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));
}
  • parse_ip_mask_opt
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));
}
  • net
  • time
Commit count: 51

cargo fmt