[][src]Struct thruster_core::route_tree::Node

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,
    // some fields omitted
}

Fields

children: HashMap<String, Node<T>>value: Stringis_wildcard: boolis_terminal_node: bool

Methods

impl<T: 'static + Context + Send> Node<T>[src]

pub fn new(value: &str) -> Node<T>[src]

pub fn new_wildcard(param_name: Option<String>) -> Node<T>[src]

pub fn add_route(&mut self, route: &str, middleware: MiddlewareChain<T>)[src]

pub fn add_subtree(&mut self, route: &str, subtree: Node<T>)[src]

pub fn match_route(
    &self,
    route: Split<char>
) -> (HashMap<String, String>, bool, &'a MiddlewareChain<T>)
[src]

pub fn match_route_with_params(
    &self,
    route: Split<char>,
    params: HashMap<String, String>
) -> (HashMap<String, String>, bool, &'a MiddlewareChain<T>)
[src]

pub fn to_string(&self, indent: &str) -> String[src]

Used mostly for debugging the route tree Example usage

This example is not tested
  let mut app = App::create(generate_context);

  app.get("/plaintext", middleware![plaintext]);
 println!("app: {}", app._route_parser.route_tree.root_node.to_string(""));
 for (route, middleware) in app._route_parser.route_tree.root_node.enumerate() {
   println!("{}: {}", route, middleware.len());
 }

pub fn enumerate(&self) -> SmallVec<[(String, MiddlewareChain<T>); 8]>[src]

pub fn push_middleware_to_populated_nodes(
    &mut self,
    other_node: &Node<T>,
    accumulated_middleware: &MiddlewareChain<T>
)
[src]

Pushes middleware down to the leaf nodes, accumulating along the way. This is helpful for propagating generic middleware down the stack

Trait Implementations

impl<T: Context + Send> Clone for Node<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<T> Send for Node<T>

impl<T> Sync for Node<T>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]