simple-builder
Easily generate builder patterns in Rust.
Usage
use Builder;
let builder = default
.name
.age;
// Note that `address` and `phone` do not have builder
// methods because of the #[build_it(skip)] attribute.
assert_eq!;
assert_eq!;
// These fields are skipped, so they're value will still be the default value.
assert_eq!;
assert_eq!;
The #[build_it(rename = "new_name")] attribute can be used to rename the builder
method. In this case, the builder method will be called new_name instead of renamed:
let builder = default
.new_name;
The #[build_it(into)] attribute can be used to allow the builder method to accept
types that can be converted into the field type. In this case, the builder method will
accept a &str instead of a String:
let builder = default
.name_into;
The #[build_it(into)] attribute can also be used on the struct itself to allow the
builder to accept Into implementations for all fields:
let builder = default
.name
.language;