[−][src]Crate cidr
This library provides types to represent an IP network (Cidr
) or
an IP host withing a network (Inet
)
The naming follows the names of the PostgreSQL data types
Address parsing also accepts IPv4 address with less than four octets (but always parses those as decimal).
Feature serde
This feature is enabled by default (not using serde-derive
, only
serde
).
In human readable formats the Display
and FromStr
interfaces are
used. Otherwise all values are serialized in the same format (apart
from the newtype wrapping) as a tuple of two values:
tag: u8
:0x00...0x20
: IPv4 with network lengthtag
0x40...0xc0
: IPv6 with network lengthtag - 0x40
0xff
:any
- address according to
tag
:Ipv4Addr
([u8; 4]
),Ipv6Addr
([u8; 16]
) or()
Re-exports
pub use Family::*; |
Structs
InetIterator | Iterator type to iterate over a list of IP addresses in a network |
Ipv4Cidr |
|
Ipv4Inet |
|
Ipv6Cidr |
|
Ipv6Inet |
|
NetworkLengthTooLongError | Error returned when the network length was longer than the address |
Enums
AnyIpCidr | Represents either an IPv4 or an IPv6 network or "any". |
Family | Represents the type of an IP address |
IpCidr |
|
IpInet |
|
NetworkParseError | Error type returned when parsing IP networks |
Traits
Cidr | Types implementing Cidr represent IP networks. An IP network in
this case is a set of IP addresses which share a common prefix (when
viewed as a bitstring). The length of this prefix is called
|
Inet | Types implementing Inet represent IP hosts within networks. |