#builder-pattern #concatenation #implemented #consuming

welder

A tool to help concatenate, implemented with a builder pattern

4 releases (2 breaking)

Uses old Rust 2015

0.3.0 Feb 11, 2018
0.2.1 Feb 10, 2018
0.2.0 Feb 10, 2018
0.1.0 Feb 10, 2018

#12 in #consuming

23 downloads per month

MIT license

12KB
164 lines

welder

A tool to help concatenate, implemented with a consuming builder pattern.

Examples

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

let welder = welder.elem("bar");
let welder = welder.elem("baz");
let welder = welder.elem("boat");

let string: String = welder.weld();

assert_eq!("foo bar baz boat", &string);
let welder = Welder::with_start(0, 12);

let vec: Vec<_> = welder.elem(14)
                        .elem(16)
                        .elem(18)
                        .weld();

assert_eq!(&[12, 0, 14, 0, 16, 0, 18], vec.as_slice());

lib.rs:

A tool to help concatenate, implemented with a consuming builder pattern.

Examples

use welder::Welder;

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

let welder = welder.elem("bar");
let welder = welder.elem("baz");
let welder = welder.elem("boat");

let string: String = welder.weld();

assert_eq!("foo bar baz boat", &string);
use welder::Welder;

let welder = Welder::with_start(0, 12);

let vec: Vec<_> = welder.elem(14)
                        .elem(16)
                        .elem(18)
                        .weld();

assert_eq!(&[12, 0, 14, 0, 16, 0, 18], vec.as_slice());

No runtime deps