Struct mustache::VecBuilder [] [src]

pub struct VecBuilder { /* fields omitted */ }

Methods

impl VecBuilder
[src]

[src]

Create a VecBuilder

[src]

Add an Encodable to the VecBuilder.

use mustache::{VecBuilder, Data};
let data: Data = VecBuilder::new()
    .push(& &"Jane Austen").unwrap()
    .push(&41usize).unwrap()
    .build();

[src]

Add a String to the VecBuilder.

use mustache::VecBuilder;
let data = VecBuilder::new()
    .push_str("Jane Austen")
    .push_str("Lewis Carroll")
    .build();

[src]

Add a bool to the VecBuilder.

use mustache::VecBuilder;
let data = VecBuilder::new()
    .push_bool(false)
    .push_bool(true)
    .build();

[src]

Add a Vec to the MapBuilder.

use mustache::VecBuilder;
let data = VecBuilder::new()
    .push_vec(|builder| {
        builder
            .push_str("Jane Austen".to_string())
            .push_str("Lewis Carroll".to_string())
    })
    .build();

[src]

Add a Map to the VecBuilder.

use mustache::VecBuilder;
let data = VecBuilder::new()
    .push_map(|builder| {
        builder
            .insert_str("first_name".to_string(), "Jane".to_string())
            .insert_str("last_name".to_string(), "Austen".to_string())
    })
    .push_map(|builder| {
        builder
            .insert_str("first_name".to_string(), "Lewis".to_string())
            .insert_str("last_name".to_string(), "Carroll".to_string())
    })
    .build();

[src]

Add a function to the VecBuilder.

use mustache::VecBuilder;
let mut count = 0;
let data = VecBuilder::new()
    .push_fn(move |s| {
        count += 1usize;
        s + &count.to_string()
    })
    .build();

[src]

Trait Implementations

impl Default for VecBuilder
[src]

[src]

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