From cc7d316e588c21de1023d6a76d4ea5e7b893977a Mon Sep 17 00:00:00 2001 From: Melody Horn / boringcactus Date: Sun, 13 Jun 2021 13:39:02 -0600 Subject: macro based url map definition --- examples/tutorial01/main.rs | 11 +++++------ examples/tutorial01/polls/urls.rs | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/tutorial01/main.rs b/examples/tutorial01/main.rs index 4db9897..f99ae7f 100644 --- a/examples/tutorial01/main.rs +++ b/examples/tutorial01/main.rs @@ -1,15 +1,14 @@ use tosin::Settings; use tosin::contrib::admin; -use tosin::http::Filter; -use tosin::urls::{UrlMap, path}; +use tosin::urls::{UrlMap, url_map}; mod polls; fn urls() -> UrlMap { - path!("polls" / ..).and(polls::urls::urls()) - .or(path!("admin" / ..).and(admin::site::urls::urls())) - .unify() - .boxed() + url_map! { + "polls" / ..polls::urls::urls(), + "admin" / ..admin::site::urls::urls(), + } } fn settings() -> Settings { diff --git a/examples/tutorial01/polls/urls.rs b/examples/tutorial01/polls/urls.rs index 184c6f8..04d93cc 100644 --- a/examples/tutorial01/polls/urls.rs +++ b/examples/tutorial01/polls/urls.rs @@ -1,9 +1,9 @@ -use tosin::http::Filter; -use tosin::urls::{UrlMap, path}; +use tosin::urls::{UrlMap, url_map}; use super::views; pub fn urls() -> UrlMap { - path::end().map(views::index) // TODO name: "index" - .boxed() + url_map! { + => views::index, // TODO name: "index" + } } -- cgit v1.2.3