ip_network
IPv4 and IPv6 network structs.
Usage
Add this to your Cargo.toml
:
[]
= "0.3"
this to your crate root (necessary just when your project is Rust 2015 edition):
extern crate ip_network;
and then you can use it like this:
use Ipv4Addr;
use Ipv4Network;
let ip_network = new.unwrap;
assert_eq!;
Minimal required version of Rust compiler is:
- 1.31 for version 0.3 and newer (because of 2018 edition),
- 1.26 for version 0.2 (because of support
u128
data type), - for older compiler you can use 0.1 version.
Serde support
To enable serialization, just add serde
feature to package in Cargo.toml
:
[]
= { = "0.3", = ["serde"] }
Postgres support
To enable support for postgres crate CIDR type, just add postgres
feature to package in Cargo.toml
:
[]
= { = "0.3", = ["postgres"] }
Diesel support
To enable support for diesel CIDR type for PostgreSQL, just add diesel
feature to package in Cargo.toml
:
[]
= { = "0.3", = ["diesel"] }
You can then use ip_network::diesel_support::PqCidrExtensionMethods
trait for CIDR operators support.