Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baoyachi/eat-nom
eat nom
https://github.com/baoyachi/eat-nom
combinator ip ipmask mask nom parser rust
Last synced: about 2 months ago
JSON representation
eat nom
- Host: GitHub
- URL: https://github.com/baoyachi/eat-nom
- Owner: baoyachi
- License: mit
- Created: 2020-04-12T09:03:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-27T04:31:17.000Z (almost 4 years ago)
- Last Synced: 2024-10-16T05:16:42.099Z (2 months ago)
- Topics: combinator, ip, ipmask, mask, nom, parser, rust
- Language: Rust
- Homepage:
- Size: 39.1 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eat-nom
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](
https://github.com/baoyachi/eat-nom)
[![Cargo](https://img.shields.io/crates/v/eat-nom.svg)](
https://crates.io/crates/eat-nom)
[![Documentation](https://docs.rs/eat-nom/badge.svg)](
https://docs.rs/eat-nom)eat nom based on [nom](https://github.com/Geal/nom). A tools about normal domain extend use nom
# 《玩转nom解析引擎》
* https://www.bilibili.com/video/BV1UK4y157BP## parse ip
* parse_ip_mask
```rust
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
```rust
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