5 releases
0.1.5 | Jul 20, 2020 |
---|---|
0.1.4 | Jul 19, 2020 |
0.1.3 | Jul 19, 2020 |
0.1.2 | Jul 19, 2020 |
0.1.0 | Apr 12, 2020 |
#94 in #parsing
11KB
227 lines
eat-nom
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
Dependencies
~2MB
~45K SLoC