front_line_router/
router_result.rs

1use crate::HttpVersion;
2
3/// Represents the result of routing an HTTP request.
4///
5/// This structure captures essential parts of an HTTP request like the route, query parameters,
6/// the HTTP version, and the remaining head and body sections.
7///
8/// The generic type `T` allows flexibility in how routes are represented. It could be a simple
9/// enum, a string, or any other type that best captures the essence of routes for a specific
10/// application.
11#[derive(PartialEq, Debug)]
12pub struct RouterResult<'a, T> {
13    /// The identified route from the HTTP request.
14    ///
15    /// This could be `None` if no matching route was found.
16    pub route: Option<T>,
17
18    /// The query string from the HTTP request.
19    ///
20    /// Represents the part after the `?` in the URL.
21    pub query: &'a str,
22
23    /// The version of the HTTP protocol used in the request.
24    pub version: HttpVersion,
25
26    /// The remaining parts of the HTTP request, typically the headers and the body.
27    pub head_and_body: &'a [u8],
28}