Trait libnetrangemerge::Range [−][src]
Types that implements the Range
trait represents a
CIDR
range.
Applications generally can use the built in types that implement
Range
in this library: IpRange
, Ipv4Range
,
and Ipv6Range
. However, those types are not available in
no_std mode - in which case the application can implement its own type that
implements this trait.
Associated Types
Loading content...Required methods
fn embiggen(&self) -> Option<Self>
[src]
Return the next larger range or None
if there is
no such valid range.
Examples
127.0.0.0/25
embiggens toSome(127.0.0.0/24)
.127.0.1.0/24
embiggens toNone
.0.0.0.0/0
embiggens toNone
.
fn host_address(&self) -> &Self::Address
[src]
Return the host address for the range.
Example
If the range represents 127.0.0.0/24
, this must
return a reference to the address 127.0.0.0
.
fn prefix_length(&self) -> u8
[src]
Return the prefix length of the range.
Example
If the range represents 127.0.0.0/24
, this must
return the value 24
.
fn is_ipv6(&self) -> bool
[src]
Return true
if this is an ipv6 range and false
if
it is an ipv4 range.
fn contains(&self, other: &Self) -> bool
[src]
Return true
if this range contains the other range and
false
otherwise.
Panic
This method may panic if self
and other
do not return
the same value for is_ipv6
.
Examples
127.0.0.0/24
contains127.0.0.128/25
.127.0.0.128/25
does not contain127.0.0.0/24
.127.0.0.0/24
contains127.0.0.0/24
.0.0.0.0/0
contains any other ipv4 network.127.0.0.1/32
contains only itself.