pub struct Node<T: 'static + Context + Send> {
pub children: HashMap<String, Node<T>>,
pub value: String,
pub is_wildcard: bool,
pub is_terminal_node: bool,
/* private fields */
}
Fields§
§children: HashMap<String, Node<T>>
§value: String
§is_wildcard: bool
§is_terminal_node: bool
Implementations§
Source§impl<T: 'static + Context + Send> Node<T>
impl<T: 'static + Context + Send> Node<T>
pub fn new(value: &str) -> Node<T>
pub fn new_wildcard(param_name: Option<String>) -> Node<T>
pub fn add_route(&mut self, route: &str, middleware: MiddlewareChain<T>)
pub fn add_subtree(&mut self, route: &str, subtree: Node<T>)
pub fn match_route( &self, route: Split<'_, char>, ) -> (HashMap<String, String>, bool, &'_ MiddlewareChain<T>)
pub fn match_route_with_params( &self, route: Split<'_, char>, params: HashMap<String, String>, ) -> (HashMap<String, String>, bool, &'_ MiddlewareChain<T>)
Sourcepub fn tree_string(&self, indent: &str) -> String
pub fn tree_string(&self, indent: &str) -> String
Used mostly for debugging the route tree Example usage
ⓘ
let mut app = App::create(generate_context);
app.get("/plaintext", middleware![plaintext]);
println!("app: {}", app._route_parser.route_tree.root_node.tree_string(""));
for (route, middleware) in app._route_parser.route_tree.root_node.get_route_list() {
println!("{}: {}", route, middleware.len());
}
pub fn get_route_list( &self, ) -> SmallVec<[(String, MiddlewareChain<T>, bool); 8]> ⓘ
Sourcepub fn push_middleware_to_populated_nodes(
&mut self,
other_node: &Node<T>,
accumulated_middleware: &MiddlewareChain<T>,
)
pub fn push_middleware_to_populated_nodes( &mut self, other_node: &Node<T>, accumulated_middleware: &MiddlewareChain<T>, )
Pushes middleware down to the leaf nodes, accumulating along the way. This is helpful for propagating generic middleware down the stack
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Node<T>
impl<T> !RefUnwindSafe for Node<T>
impl<T> Send for Node<T>
impl<T> Sync for Node<T>
impl<T> Unpin for Node<T>
impl<T> !UnwindSafe for Node<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more