1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
use crate::http::{Response, MethodHandler}; use std::future::Future; #[allow(dead_code)] pub struct Path { original: String } impl Path { pub fn new<T: Into<String>>(original: T) -> Path { Path { original: original.into() } } pub fn such_that<F: Fn() -> T, T: Future<Output = Response>>(self, _method_handler: MethodHandler<F, T>) -> Self { //self.handler = method_handler; self } pub(crate) fn get_root(&self) -> String { self.original.clone() } } //let path = Path::new("/hello").replies(Method::Get.with(my_function));