Liquid for loop passing a vector or an array



examples/liquid/liquid-for-loop/src/main.rs
fn main() {
    let template = "
        {% for color in colors %}
           {{color}}
        {% endfor %}
    ";

    let template = liquid::ParserBuilder::with_stdlib()
        .build().unwrap()
        .parse(template).unwrap();

    //let colors: [&str; 3] = ["red", "green", "blue"];
    let colors = vec!["red", "green", "blue"];

    let globals = liquid::object!({
        "colors": colors,
    });
    let output = template.render(&globals).unwrap();
    println!("{}", output);
}

examples/liquid/liquid-for-loop/out.txt
        
           red
        
           green
        
           blue