Struct perseus::template::Template [−][src]
pub struct Template<G: GenericNode> { /* fields omitted */ }
Expand description
This allows the specification of all the template templates in an app and how to render them. If no rendering logic is provided at all, the template will be prerendered at build-time with no state. All closures are stored on the heap to avoid hellish lifetime specification. All properties for templates are passed around as strings to avoid type maps and other horrible things, this only adds one extra deserialization call at build time.
Implementations
Executes the user-given function that renders the template on the server-side (build or request time).
Gets the list of templates that should be prerendered for at build-time.
Gets the initial state for a template. This needs to be passed the full path of the template, which may be one of those generated by
.get_build_paths()
.
Gets the request-time state for a template. This is equivalent to SSR, and will not be performed at build-time. Unlike
.get_build_paths()
though, this will be passed information about the request that triggered the render. Errors here can be caused
by either the server or the client, so the user must specify an ErrorCause
.
Amalagmates given request and build states. Errors here can be caused by either the server or the client, so the user must specify
an ErrorCause
.
Checks, by the user’s custom logic, if this template should revalidate. This function isn’t presently parsed anything, but has
network access etc., and can really do whatever it likes. Errors here can be caused by either the server or the client, so the
user must specify an ErrorCause
.
Gets the path of the template. This is the root path under which any generated pages will be served. In the simplest case, there will only be one page rendered, and it will occupy that root position.
Gets the interval after which the template will next revalidate.
Checks if this template can revalidate existing prerendered templates.
Checks if this template can revalidate existing prerendered templates after a given time.
Checks if this template can revalidate existing prerendered templates based on some given logic.
Checks if this template can render more templates beyond those paths it explicitly defines.
Checks if this template is a template to generate paths beneath it.
Checks if this template needs to do anything on requests for it.
Checks if this template needs to do anything at build time.
Checks if this template has custom logic to amalgamate build and reqquest states if both are generated.
Checks if this template defines no rendering logic whatsoever. Such templates will be rendered using SSG.
Sets the template rendering function to use.
Enables the build paths strategy with the given function.
Enables the incremental generation strategy with the given function.
Enables the build state strategy with the given function.
Enables the request state strategy with the given function.
Enables the revalidation strategy (logic variant) with the given function.
Enables the revalidation strategy (time variant). This takes a time string of a form like 1w
for one week. More details are available
in the book.
Enables state amalgamation with the given function.
Trait Implementations
Auto Trait Implementations
impl<G> !RefUnwindSafe for Template<G>
impl<G> !UnwindSafe for Template<G>
Blanket Implementations
Mutably borrows from an owned value. Read more