aboutsummaryrefslogtreecommitdiff
path: root/src/router.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/router.rs')
-rw-r--r--src/router.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/router.rs b/src/router.rs
index 0bba091..35fdf3e 100644
--- a/src/router.rs
+++ b/src/router.rs
@@ -1,4 +1,4 @@
-use regex::{Regex};
+use regex::Regex;
const ACTION_REGEX: &str = r"/{0,1}(?P<action>\w*)/(?P<id>.+)";
@@ -14,14 +14,15 @@ impl Router {
let caps = re.captures(path);
let action = match caps {
Some(ref value) => &value["action"],
- None => "index"
+ None => "index",
};
match action {
- "posts" => Router::Post { page: caps.unwrap()["id"].to_string() },
+ "posts" => Router::Post {
+ page: caps.unwrap()["id"].to_string(),
+ },
"index" => Router::Index,
- _ => Router::NotFound
+ _ => Router::NotFound,
}
}
}
-