Struct mustache::VecBuilder
[−]
[src]
pub struct VecBuilder { /* fields omitted */ }
Methods
impl VecBuilder
[src]
pub fn new() -> VecBuilder
[src]
Create a VecBuilder
pub fn push<T: Serialize>(self, value: &T) -> Result<VecBuilder, Error>
[src]
Add an Encodable
to the VecBuilder
.
use mustache::{VecBuilder, Data}; let data: Data = VecBuilder::new() .push(& &"Jane Austen").unwrap() .push(&41usize).unwrap() .build();
pub fn push_str<T: ToString>(self, value: T) -> VecBuilder
[src]
Add a String
to the VecBuilder
.
use mustache::VecBuilder; let data = VecBuilder::new() .push_str("Jane Austen") .push_str("Lewis Carroll") .build();
pub fn push_bool(self, value: bool) -> VecBuilder
[src]
Add a bool
to the VecBuilder
.
use mustache::VecBuilder; let data = VecBuilder::new() .push_bool(false) .push_bool(true) .build();
pub fn push_vec<F>(self, f: F) -> VecBuilder where
F: FnMut(VecBuilder) -> VecBuilder,
[src]
F: FnMut(VecBuilder) -> VecBuilder,
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();
pub fn push_map<F>(self, f: F) -> VecBuilder where
F: FnMut(MapBuilder) -> MapBuilder,
[src]
F: FnMut(MapBuilder) -> MapBuilder,
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();
pub fn push_fn<F>(self, f: F) -> VecBuilder where
F: FnMut(String) -> String + Send + 'static,
[src]
F: FnMut(String) -> String + Send + 'static,
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();
pub fn build(self) -> Data
[src]
Trait Implementations
impl Default for VecBuilder
[src]
fn default() -> VecBuilder
[src]
Returns the "default value" for a type. Read more