Struct ::exo::Templating

Overview

The templating struct allows you to execute gobal templates and render them towards a .pdf file.

Methods

fn new(env: Environment) -> Templating

Creates a new Templating from an Environment. It makes all templates of the Environment available.

Example

let env = exo::get_environment();
let templating = exo::Templating::new(env);
assert!(templating is exo::Templating);
fn empty() -> Templating

Creates a new empty Templating.

Example

let templating = exo::Templating::empty();
assert!(templating is exo::Templating);
fn to_pdf(self, template: String) -> Result

Generate a .pdf document as raw binary data.

Example

let templating = exo::Templating::empty();
templating.add_template("main", "Hello World!");
assert!(templating.to_pdf("main").is_ok());
fn add_template(self, path: String, template: String) -> Tuple

Adds a new template to the templating system.

Example

let templating = exo::Templating::empty();
templating.add_template("main", "Hello World!");
fn add_file(self, path: String, data: Bytes) -> Tuple

Adds a new file to the templating system. This file can either be an image or data used by the templating.

Example

let templating = exo::Templating::empty();
templating.add_file("main", b"Some data");

Protocols

protocol string_debug
println("{:?}", value)

Allows the value to be debug printed.