Skip to main content

lava_http/server/
route.rs

1use crate::{response::res::Response, request::req::Request};
2
3pub struct Route{
4    pub handler:   fn(Response, &Request) -> Response,
5    pub path:      &'static str,
6    pub method:    &'static str
7}
8
9impl Route{
10    pub fn get_func(&self) 
11    -> fn(Response, &Request) 
12    -> Response{
13        return self.handler;
14    }
15
16    pub fn get_path(&self) -> String{
17        let path: String = String::from(self.path);
18        
19        return path;
20    }
21
22    pub fn get_method(&self) -> String{
23        let method: String = String::from(self.method);
24
25        return method;
26    }
27}