Struct perseus::error_pages::ErrorPages [−][src]
pub struct ErrorPages<G: GenericNode> { /* fields omitted */ }
Expand description
A type alias for the HashMap
the user should provide for error pages.
Implementations
pub fn new(
fallback: impl Fn(String, u16, String, Option<Rc<Translator>>) -> SycamoreTemplate<G> + 'static
) -> Self
pub fn new(
fallback: impl Fn(String, u16, String, Option<Rc<Translator>>) -> SycamoreTemplate<G> + 'static
) -> Self
Creates a new definition of error pages with just a fallback.
Adds a new page for the given status code. If a page was already defined for the given code, it will be updated by the mechanics of
the internal HashMap
.
Adds a new page for the given status code. If a page was already defined for the given code, it will be updated by the mechanics of
the internal HashMap
. This differs from .add_page()
in that it takes an Rc
, which is useful for plugins.
pub fn get_template_for_page(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>
) -> SycamoreTemplate<G>
pub fn get_template_for_page(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>
) -> SycamoreTemplate<G>
Gets the template for a page without rendering it into a container.
pub fn render_page(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>,
container: &Element
)
pub fn render_page(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>,
container: &Element
)
Renders the appropriate error page to the given DOM container.
pub fn hydrate_page(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>,
container: &Element
)
pub fn hydrate_page(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>,
container: &Element
)
Hydrates the appropriate error page to the given DOM container. This is used for when an error page is rendered by the server and then needs interactivity.
pub fn render_to_string(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>
) -> String
pub fn render_to_string(
&self,
url: &str,
status: &u16,
err: &str,
translator: Option<Rc<Translator>>
) -> String
Renders the error page to a string. This should then be hydrated on the client-side.
Trait Implementations
Auto Trait Implementations
impl<G> !RefUnwindSafe for ErrorPages<G>
impl<G> !Send for ErrorPages<G>
impl<G> !Sync for ErrorPages<G>
impl<G> Unpin for ErrorPages<G>
impl<G> !UnwindSafe for ErrorPages<G>
Blanket Implementations
Mutably borrows from an owned value. Read more