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]

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.

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.

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

Returns the number of bits in the prefix.

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

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

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

Returns the number of common leading bits with the input name.

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

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).

Returns the smallest name matching the prefix

Returns the largest name matching the prefix

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

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

Returns the given name with first bits replaced by self

Trait Implementations

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

Returns a copy of the value. Read more

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]

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

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

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

Deserialize a value using a Decoder.

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

Serialize a value using an Encoder.

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

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

This method tests for !=.

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

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

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

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

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

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

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

Formats the value using the given formatter.

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

Formats the value using the given formatter.