pub struct Node<P, R: Request, T, C> { /* private fields */ }
Expand description
The building block of a routing tree.
Each node can contain handlers, which will be used when this is the node reached at the end of the path, as well as children, which will be traversed otherwise.
Implementations
Add a method handler to this node.
For use with async, you may wish to use [with_handler_async
] instead.
Add a child node with a constant path. The path argument must end at the end of a path segment, but can contain slashes in order to skip levels
Example
trout::Node::new()
.with_child("items", other_node);
pub fn with_child_str<P2: TupleAdd<P, String> + 'static>(
self,
child: Node<P2, R, T, C>
) -> Self
pub fn with_child_str<P2: TupleAdd<P, String> + 'static>(
self,
child: Node<P2, R, T, C>
) -> Self
Add a child node with a dynamic path segment (string form)
Example
trout::Node::new()
.with_child_str(other_node)
Perform routing for a request