Struct inapi::Template [] [src]

pub struct Template { /* fields omitted */ }

Primitive for rendering templates into uploadable files.

Examples

 let template = Template::new("/path/to/template").unwrap();
 let data = MapBuilder::new().insert_str("key", "value").build();
 let rendered_file = template.render_data(&data).unwrap();

To upload the rendered file to your host, you can pass it straight into the File primitive:

let mut host = Host::connect("hosts/myhost.json").unwrap();

let file = File::new(&mut host, "/path/to/remote/file").unwrap();
file.upload_file(&mut host, rendered_file, None).unwrap();

Methods

impl Template
[src]

[src]

Create a new File struct.

[src]

Render template to file using generic Encodable data.

[src]

Render template to file using a Data instance.