Releases: colin-kiegel/rust-derive-builder
Releases · colin-kiegel/rust-derive-builder
2017-06-30
Changed
#[builder(default)]
and#[builder(default="...")]
at the struct level
change their behaviour and construct a default value for the struct,
instead of all fields individually.- builder fields are no longer public by default; Fields can be explicitly
made public at the struct or field level using the new attribute:
#[builder(field(public))]
Removed
- removed previously deprecated syntax
#[builder(setter_prefix="with")]
,
please use#[builder(setter(prefix="with"))]
instead
2017-04-29
Fixed
- for generic structs, apply the T: Clone type bound in builder impl instead of struct definition #91
- only emit the T: Clone type bound when it is actually needed, i.e. mutable/immutable pattern, but not owned pattern.
2017-04-26
Added
- pre-build validation via
#[builder(build_fn(validate="path::to::fn"))]
2017-04-12
Added
- customize setter names via
#[builder(setter(name="..."))]
- customize build_fn name via
#[builder(build_fn(name="..."))]
- suppress build method generation via
#[builder(build_fn(skip))]
- derive additional traits via
#[builder(derive(Trait1, Trait2, ...))]
- set field visibility separate from setter visibility via
#[builder(field(private))]
at the field or struct level
Deprecated
- builder fields will no longer be public by default in 0.5.0; relying on this
will now emit a deprecation warning. Fields can be explicitly made public at
the struct or field level using the new#[builder(field(public))]
attribute. To squelch this warning and opt-into the new behaviour, use the
private_fields
crate feature or explicitly set field visibility at the
struct level.
2017-04-12
Added
- fallible setters, e.g.
#[builder(try_setter)]
. These setters are exposed
alongside the normal field setters and allow callers to pass in values which
have fallible conversions to the needed type throughTryInto
. This
attribute can only be used on nightly when#![feature(try_from)]
is
declared in the consuming crate's root; this will change when Rust issue
#33417 is resolved.
2017-04-11
Fixed
setter(skip)
honors struct-inherited and explicit defaults #68
2017-04-10
2017-04-08
Deprecated
#[builder(default)]
and#[builder(default="...")]
at the struct level will
change their behaviour in 0.5.0 and construct a default value for the struct,
instead of all fields individually. To opt into the new behaviour and squelch
this deprecation warning you can add thestruct_default
feature flag.
2017-03-25
Added
- skip setters, e.g.
#[builder(setter(skip))]
- default values, e.g.
#[builder(default="42")]
or just#[builder(default)]
Changed
- deprecated syntax
#[builder(setter_prefix="with")]
,
please use#[builder(setter(prefix="with"))]
instead - setter conversions are now off by default, you can opt-into via
#[builder(setter(into))]
- logging is behind a feature flag. To activate it, please add
features = ["logging"]
to the dependency inCargo.toml
. Then you can use
it like:RUST_LOG=derive_builder=trace cargo test
.
Fixed
macros 1.1
Added
- different setter pattern, e.g.
#[builder(pattern="immutable")]
- private setters, e.g.
#[builder(private)]
- additional debug info via env_logger, e.g.
RUST_LOG=derive_builder=trace cargo test
- prefixes, e.g.
#[builder(setter_prefix="with")]
- field specific overrides
- customize builder name, e.g.
#[builder(name="MyBuilder")]
Changed
- migration to macros 1.1
- migration to traditional builder pattern
i.e. seperateFooBuilder
struct to buildFoo
=> please refer to the new docs
Fixed
- missing lifetime support #21