-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Anything wrapped in an `Rc` in a `Template` or an error page no longer needs it! BREAKING CHANGE: `Rc`s are eliminated and done behind the scenes
- Loading branch information
1 parent
488a9a0
commit d02189b
Showing
26 changed files
with
152 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
use perseus::{ErrorPages, GenericNode}; | ||
use std::rc::Rc; | ||
use sycamore::template; | ||
|
||
pub fn get_error_pages<G: GenericNode>() -> ErrorPages<G> { | ||
let mut error_pages = ErrorPages::new(Rc::new(|url, status, err, _| { | ||
let mut error_pages = ErrorPages::new(|url, status, err, _| { | ||
template! { | ||
p { (format!("An error with HTTP code {} occurred at '{}': '{}'.", status, url, err)) } | ||
} | ||
})); | ||
error_pages.add_page( | ||
404, | ||
Rc::new(|_, _, _, _| { | ||
template! { | ||
p { "Page not found." } | ||
} | ||
}), | ||
); | ||
}); | ||
error_pages.add_page(404, |_, _, _, _| { | ||
template! { | ||
p { "Page not found." } | ||
} | ||
}); | ||
|
||
error_pages | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
use perseus::{ErrorPages, GenericNode}; | ||
use std::rc::Rc; | ||
use sycamore::template; | ||
|
||
pub fn get_error_pages<G: GenericNode>() -> ErrorPages<G> { | ||
let mut error_pages = ErrorPages::new(Rc::new(|_, _, err, _| { | ||
let mut error_pages = ErrorPages::new(|_, _, err, _| { | ||
template! { | ||
p { (format!("Another error occurred: '{}'.", err)) } | ||
} | ||
})); | ||
error_pages.add_page( | ||
404, | ||
Rc::new(|_, _, _, _| { | ||
template! { | ||
p { "Page not found." } | ||
} | ||
}), | ||
); | ||
error_pages.add_page( | ||
400, | ||
Rc::new(|_, _, _, _| { | ||
template! { | ||
p { "Client error occurred..." } | ||
} | ||
}), | ||
); | ||
}); | ||
error_pages.add_page(404, |_, _, _, _| { | ||
template! { | ||
p { "Page not found." } | ||
} | ||
}); | ||
error_pages.add_page(400, |_, _, _, _| { | ||
template! { | ||
p { "Client error occurred..." } | ||
} | ||
}); | ||
|
||
error_pages | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,23 @@ | ||
use perseus::{ErrorPages, GenericNode}; | ||
use std::rc::Rc; | ||
use sycamore::template; | ||
|
||
pub fn get_error_pages<G: GenericNode>() -> ErrorPages<G> { | ||
let mut error_pages = ErrorPages::new(Rc::new(|_, _, _, _| { | ||
let mut error_pages = ErrorPages::new(|_, _, _, _| { | ||
template! { | ||
p { "Another error occurred." } | ||
} | ||
})); | ||
error_pages.add_page( | ||
404, | ||
Rc::new(|_, _, err, _| { | ||
template! { | ||
p { "Page not found." } | ||
p { (err) } | ||
} | ||
}), | ||
); | ||
error_pages.add_page( | ||
400, | ||
Rc::new(|_, _, _, _| { | ||
template! { | ||
p { "Client error occurred..." } | ||
} | ||
}), | ||
); | ||
}); | ||
error_pages.add_page(404, |_, _, err, _| { | ||
template! { | ||
p { "Page not found." } | ||
p { (err) } | ||
} | ||
}); | ||
error_pages.add_page(400, |_, _, _, _| { | ||
template! { | ||
p { "Client error occurred..." } | ||
} | ||
}); | ||
|
||
error_pages | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.