Trait iron_archivist::Renderer
[−]
[src]
pub trait Renderer { fn render_dir(&self, path_str: &str, entries: &[Entry]) -> RenderResult; fn render_verbatim(&self, path_str: &str, content: &str) -> RenderResult; fn render_markdown(&self, path_str: &str, content: &str) -> RenderResult; fn render_error(
&self,
path_str: &str,
code: usize,
message: &str
) -> RenderResult; }
A renderer that renders the webpage in the response
An implementation is provided for
tera::Tera.
Turn on the tera
feature to use this implementation.
See examples/simple.rs
for a minimal implementation of the renderer.
Required Methods
fn render_dir(&self, path_str: &str, entries: &[Entry]) -> RenderResult
Renders the list of entries in a directory.
Arguments
path_str
- The path to the specified directory as anstr
sliceentries
- The entries in the specified path
fn render_verbatim(&self, path_str: &str, content: &str) -> RenderResult
Renders the unmodified textual content of a file.
Arguments
path_str
- The path to the specified file as anstr
sliceentries
- The textual content of the file
fn render_markdown(&self, path_str: &str, content: &str) -> RenderResult
Renders a file as a Markdown file.
Arguments
path_str
- The path to the specified file as anstr
slicecontent
- The content of the file, already rendered to HTML
fn render_error(
&self,
path_str: &str,
code: usize,
message: &str
) -> RenderResult
&self,
path_str: &str,
code: usize,
message: &str
) -> RenderResult
Renders an error message
Arguments
path_str
- The path to the specified file as anstr
slicecode
- HTTP status code for the errormessage
- An message describing the error