Struct routecore::addr::MaxLenPrefix [−][src]
pub struct MaxLenPrefix { /* fields omitted */ }
Expand description
The pair of a prefix and an optional max-len.
Ordering
The ordering of MaxLenPrefixes is similar to the ordering of Prefixes. The only difference is the optional MaxLen. When two prefixes are equal but differ in (presence of) max_len, the order is as follows:
- any max_len always comes before no max_len
- a larger (higher) max_len comes before a smaller (lower) max_len (e.g. 24 comes before 20). This is analog to how more-specifics come before less-specifics.
Note that the max_len can either be equal to the prefix length (with no practical difference from an omitted max_len) or larger than the prefix length. The max_len can not be smaller than the prefix length. Because of that, we can safely order ‘any max_len’ before ‘no max_len’ for equal prefixes.
Implementations
Creates a new value.
The function returns an error if max_len
is present and smaller than
prefix.len()
or larger than the maximum prefix length of the
prefix’s address family.
Creates a value curtailing any out-of-bounds max-len.
Returns the prefix length.
Returns the max-length or the prefix-length if there is no max-length.
Trait Implementations
See Ordering in the type documentation.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
See Ordering in the type documentation.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for MaxLenPrefix
impl Send for MaxLenPrefix
impl Sync for MaxLenPrefix
impl Unpin for MaxLenPrefix
impl UnwindSafe for MaxLenPrefix
Blanket Implementations
Mutably borrows from an owned value. Read more