pub trait Template: Display {
const EXTENSION: Option<&'static str>;
const SIZE_HINT: usize;
const MIME_TYPE: &'static str;
// Required method
fn render_into(&self, writer: &mut (impl Write + ?Sized)) -> Result<()>;
// Provided methods
fn render(&self) -> Result<String> { ... }
fn write_into(&self, writer: &mut (impl Write + ?Sized)) -> Result<()> { ... }
}
Expand description
Main Template
trait; implementations are generally derived
If you need an object-safe template, use DynTemplate
.
Required Associated Constants§
sourceconst SIZE_HINT: usize
const SIZE_HINT: usize
Provides a rough estimate of the expanded length of the rendered template. Larger
values result in higher memory usage but fewer reallocations. Smaller values result in the
opposite. This value only affects render
. It does not take effect when calling
render_into
, write_into
, the fmt::Display
implementation, or the blanket
ToString::to_string
implementation.
Required Methods§
Provided Methods§
Object Safety§
This trait is not object safe.