Skip to content

Commit

Permalink
refactor: ♻️ changed define_app!'s router to use curly brackets
Browse files Browse the repository at this point in the history
This just makes more sense with Rust's `match` syntax.
  • Loading branch information
arctic-hen7 committed Sep 2, 2021
1 parent a2fbb28 commit d5519b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub enum Route {
define_app!{
root: "#root",
route: Route,
router: [
router: {
Route::Index => [
"index".to_string(),
pages::index::template_fn()
Expand All @@ -24,7 +24,7 @@ define_app!{
"about".to_string(),
pages::about::template_fn()
]
],
},
error_pages: crate::error_pages::get_error_pages(),
templates: [
crate::pages::index::get_page::<G>(),
Expand Down
4 changes: 2 additions & 2 deletions packages/perseus/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ macro_rules! define_app {
route: $route:ty,
// The user will define something very similar to a macro pattern, which will return the template's name and its render function
// We don't use a match statement because we abstract `NotFound` matching
router: [
router: {
$(
$pat:pat => [
$name:expr,
$fn:expr
]
),+
],
},
error_pages: $error_pages:expr,
templates: [
$($template:expr),+
Expand Down

0 comments on commit d5519b9

Please sign in to comment.