Skip to content

Commit b694634

Browse files
committed
README: Add a containment example
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
1 parent ac96adc commit b694634

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ let net: NetAddr = "ff02::1/128".parse().unwrap();
1818
let net: Netv4Addr = "203.0.113.19/29".parse().unwrap();
1919
```
2020

21+
You can do some operations with these parsed structures, like checking address containment:
22+
23+
```rust
24+
let net: NetAddr = "10.10.10.0/24".parse().unwrap();
25+
let addr: IpAddr = "10.10.10.1".parse().unwrap();
26+
assert!(net.contains(&addr));
27+
```
28+
2129
(More options will be added eventually.)
2230

2331
## Vision

0 commit comments

Comments
 (0)