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 actual prefix.

Returns the address of the prefix.

Returns the prefix length.

Returns the max-length.

Returns the max-length or the prefix-length if there is no max-length.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

See Ordering in the type documentation.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.