Struct welder::Welder [] [src]

pub struct Welder<G, T> { /* fields omitted */ }

An helper struct to accumalate elements.

Methods

impl<G, T: Default> Welder<G, T>
[src]

[src]

Create an empty Welder just by defining the glue used.

Examples

use welder::Welder;

let welder = Welder::new(' ');

let string: String = welder.weld();

assert_eq!("", &string);

[src]

Create a Welder with a first value and the glue it will use.

Examples

use welder::Welder;

let welder = Welder::with_start(' ', "foo");

let string: String = welder.weld();

assert_eq!("foo", &string);

impl<G, T> Welder<G, T>
[src]

[src]

Retrieve the accumulated values from the Welder.

Examples

use welder::Welder;

let welder = Welder::with_start(' ', "foo");

let welder = welder.push("bar").push("baz").push("foo");

let string: String = welder.weld();

assert_eq!("foo bar baz foo", &string);

[src]

This will add the element without any glue.

Examples

use welder::Welder;

let welder = Welder::with_start(' ', "foo");

let welder = welder.push_no_glue("bar");
let welder = welder.push_no_glue("baz");

let string: String = welder.weld();

assert_eq!("foobarbaz", &string);

impl<G, T> Welder<G, T> where
    G: Clone,
    T: Extend<G>, 
[src]

[src]

Push a new value to the already accumulated values. This function will add a glue element in front of the element.

Examples

use welder::Welder;

let welder = Welder::new(' ');

let welder = welder.push("foo");
let welder = welder.push("bar");
let welder = welder.push("baz");

let string: String = welder.weld();

assert_eq!(" foo bar baz", &string);

[src]

It will add a glue only to right of the element.

Examples

use welder::Welder;

let welder = Welder::with_start(' ', "foo");

let welder = welder.push_glue_right("bar");
let welder = welder.push_glue_right("baz");

let string: String = welder.weld();

assert_eq!("foobar baz ", &string);

[src]

This is the default push function. It will add a glue only to left of the element.

Examples

use welder::Welder;

let welder = Welder::new(' ');

let welder = welder.push_glue_left("foo");

let string: String = welder.weld();

assert_eq!(" foo", &string);

[src]

This will add a glue on both sides of the element.

Examples

use welder::Welder;

let welder = Welder::new(' ');

let welder = welder.push_glue_both("foo");

let string: String = welder.weld();

assert_eq!(" foo ", &string);