Struct liquid::Parser [] [src]

pub struct Parser { /* fields omitted */ }

Methods

impl Parser
[src]

[src]

[src]

Parses a liquid template, returning a Template object.

Examples

Minimal Template

let template = liquid::ParserBuilder::with_liquid()
    .build()
    .parse("Liquid!").unwrap();

let globals = liquid::Object::new();
let output = template.render(&globals).unwrap();
assert_eq!(output, "Liquid!".to_string());

[src]

Parse a liquid template from a file, returning a Result<Template, Error>.

Examples

Minimal Template

template.txt:

"Liquid {{data}}"

Your rust code:

let template = liquid::ParserBuilder::with_liquid()
    .build()
    .parse_file("path/to/template.txt").unwrap();

let mut globals = liquid::Object::new();
globals.insert("data".to_owned(), liquid::Value::Num(4f32));
let output = template.render(&globals).unwrap();
assert_eq!(output, "Liquid! 4\n".to_string());

Trait Implementations

impl Default for Parser
[src]

[src]

Returns the "default value" for a type. Read more

impl Clone for Parser
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more