Struct routing::Prefix [] [src]

pub struct Prefix<T: Clone + Copy + Default + Binary + Xorable> { /* fields omitted */ }

A section prefix, i.e. a sequence of bits specifying the part of the network's name space consisting of all names that start with this sequence.

Methods

impl<T: Clone + Copy + Default + Binary + Xorable> Prefix<T>
[src]

[src]

Creates a new Prefix with the first bit_count bits of name. Insignificant bits are all set to 0. If bit_count exceeds the size of T in bits, then it is reduced to this lower value.

[src]

Returns a VersionedPrefix with this prefix and the given version number.

[src]

Returns self with an appended bit: 0 if bit is false, and 1 if bit is true. If self.bit_count is already at the maximum for this type, then an unmodified copy of self is returned.

[src]

Returns a prefix copying the first bitcount() - 1 bits from self, or self if it is already empty.

[src]

Returns the number of bits in the prefix.

[src]

Returns true if self is a prefix of other or vice versa.

[src]

Returns true if other is compatible but strictly shorter than self.

[src]

Returns true if the other prefix differs in exactly one bit from this one.

[src]

Returns the number of common leading bits with the input name, capped with prefix length.

[src]

Returns true if this is a prefix of the given name.

[src]

Compares the distance of self and other to target. Returns Less if self is closer, Greater if other is closer, and compares the prefix directly if of equal distance (this is to make sorting deterministic).

[src]

Returns the smallest name matching the prefix

[src]

Returns the largest name matching the prefix

[src]

Returns whether the namespace defined by self is covered by prefixes in the prefixes set

[src]

Returns the neighbouring prefix differing in the i-th bit If i is larger than our bit count, self is returned

[src]

Returns the given name with first bits replaced by self

[src]

Returns the same prefix, with the last bit flipped, or unchanged, if empty.

Trait Implementations

impl<T: Clone + Clone + Copy + Default + Binary + Xorable> Clone for Prefix<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Copy + Clone + Copy + Default + Binary + Xorable> Copy for Prefix<T>
[src]

impl<T: Default + Clone + Copy + Default + Binary + Xorable> Default for Prefix<T>
[src]

[src]

Returns the "default value" for a type. Read more

impl<T: Eq + Clone + Copy + Default + Binary + Xorable> Eq for Prefix<T>
[src]

impl<T: Clone + Copy + Default + Binary + Xorable> PartialEq<Prefix<T>> for Prefix<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<T: Clone + Copy + Default + Binary + Xorable> PartialOrd<Prefix<T>> for Prefix<T>
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

impl<T: Clone + Copy + Default + Binary + Xorable> Ord for Prefix<T>
[src]

[src]

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

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl<T: Clone + Copy + Default + Binary + Xorable> Hash for Prefix<T>
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

impl<T: Clone + Copy + Default + Binary + Xorable> Binary for Prefix<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: Clone + Copy + Default + Binary + Xorable> Debug for Prefix<T>
[src]

[src]

Formats the value using the given formatter.