Struct gotham::router::tree::node::Node

source ·
pub struct Node { /* private fields */ }
Expand description

A recursive member of Tree, representative of segment(s) in a request path.

Each node includes 0..n Route instances, which can be further evaluated by the Router based on a match. Every node may also have 0..n children to provide the recursive tree representation.

Implementations§

Creates new Node for the given segment and type.

Adds a new child Node instance to this Node.

Adds a Route to this Node, to be potentially evaluated by the Router.

Borrows a child Node based on the defined segment bounds.

Borrows a mutable child Node based on the defined segment bounds.

Determines if a child exists based on the defined segment bounds.

Determines if this Node has any valid Route values attached.

Traverses this Node and its children, attempting to a locate a path of Node instances which match all segments of the provided Request path. The final Node must have at least a single Route attached in order to be returned.

Only the first matching path is returned from this method, and the value is wrapped in an Option as there may be no matching node.

Children are searched in a most to least specific order of segments, based on the node SegmentType value:

  1. Static
  2. Constrained
  3. Dynamic
  4. Glob

This method is a wrapping of an internal recursive implementation to mask the required types needed for the recursion.

Retrieves a reference to the contained segment value.

This is required for lifetime related annotations.

Determines if a Route instance associated with this Node is willing to Handle the request.

Where multiple Route instances could possibly handle the Request only the first, ordered per creation, is invoked.

Where no Route instances will accept the Request the resulting Error will be the union of the RouteNonMatch values returned from each Route.

In the situation where all these avenues are exhausted an InternalServerError will be provided.

Trait Implementations§

Compares two Node values to determine an appropriate Ordering.

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

Compares two Node values for equality based on the segments they represent.

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Compares two Node values to determine an appropriate Ordering.

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
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.