[][src]Trait yarte::Template

pub trait Template: Display {
    fn mime() -> &'static str
    where
        Self: Sized
;
fn size_hint() -> usize; fn call(&self) -> Result<String> { ... } }

Template trait, will implement by derive like Display or actix_web::Responder (with feature)

use yarte::Template;

#[derive(Template)]
#[template(src="Hello, {{ name }}!")]
struct HelloTemplate<'a> {
    name: &'a str,
}

println!("{}", HelloTemplate { name: "world" })

Required methods

fn mime() -> &'static str where
    Self: Sized

https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types

fn size_hint() -> usize

Approximation of output size used in method call. Yarte implements an heuristic algorithm of allocation.

Loading content...

Provided methods

fn call(&self) -> Result<String>

which will write this template

Loading content...

Implementors

Loading content...