All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
syn
to version 2 #308darling
to version 0.20.6 #308field(type = "...")
as syn
no longer allows this. #308builder(default = ...)
expressions #308field(ty = "...")
as an alias for field(type = "...")
in preparation for moving to syn 2.0, which doesn't allow the use of keywords as meta item paths. #306build_fn(error(validation_error = <bool>))
to disable generation of ValidationError
within the builder's error so that alloc::string
is avoided.alloc
for controlling linking of alloc
crate during no_std
. This way users can use no_std
without providing a global_allocator
.strip_option
from setter
for try_setter
. Using these settings together previously caused a compile error #284default
is used with field(type = "...")
rather than silently ignoring default
#269crate = "..."
to support re-export scenarios #274vis = "..."
for builders, build methods, setters, and fields #247#[builder(field(type = "..."))]
#246#[builder(field(build = "..."))]
#246darling
, proc-macro2
, syn
, and quote
dependencies #250allow
and cfg
attributes from the deriving struct to the builder and its impl block #222#[builder_struct_attr(...)]
impl
block using #[builder_impl_attr(...)]
#[builder(setter(each = "..."))]
and #[builder(setter(each(name = "...")))]
#234Into
using `#[builder(setter(each(name = “...”, into)))] #234 and #214#[builder_field_attr(...)]
and #[builder_setter_attr(...)]
#237derive_builder_core
from derive_builder
#206std
in no_std contexts #204Default
bound #178derive_builder_core
private #189setter(each = "name")
for extension of collection-like fields #199Default
bound #178derive_builder_core
private #189setter(custom)
to allow implementing a custom setter #154darling
dependency to 0.10.2 #153strip_option
flag for setter #116darling
to 0.8.5
and switched to better errorssyn
0.13.10. #120quote
0.5.2 #120Clone
is no longer derived on a builder using the owned pattern unless it has a field override that uses the mutable/immutable pattern. #97#[builder(private)]
at the struct level will now emit a private builder. #99build_fn(private)
to generate a build method only accessible within the mod scope #89darling
0.6.3 #120collections
crate was merged into alloc
(PR). Correspondingly when using this crate within a crate with #![no_std]
you must use #![feature(alloc)] extern crate alloc
in your crate, was #![feature(collections)] extern crate collections
.unused_mut
lint (variable does not need to be mutable) #104#[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(field(public))]
#[builder(setter_prefix = "with")]
, please use #[builder(setter(prefix = "with"))]
insteadT: Clone
type bound in builder impl instead of struct definition #91T: Clone
type bound when it is actually needed, i.e. mutable/immutable pattern, but not owned pattern.#[builder(build_fn(validate = "path::to::fn"))]
#[builder(setter(name = "..."))]
#[builder(build_fn(name = "..."))]
#[builder(build_fn(skip))]
#[builder(derive(Trait1, Trait2, ...))]
#[builder(field(private))]
at the field or struct level#[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.#[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 through TryInto
. 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.setter(skip)
honors struct-inherited and explicit defaults #68#![no_std]
#63#[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 the struct_default
feature flag.#[builder(setter(skip))]
#[builder(default = "42")]
or just #[builder(default)]
#[builder(setter_prefix = "with")]
, please use #[builder(setter(prefix = "with"))]
instead#[builder(setter(into))]
features = ["logging"]
to the dependency in Cargo.toml
. Then you can use it like: RUST_LOG=derive_builder=trace cargo test
.#[deny(missing_docs)]
#37#![no_std]
via #[builder(no_std)]
#41Requires Rust 1.15 or newer.
#[builder(pattern = "immutable")]
#[builder(private)]
RUST_LOG=derive_builder=trace cargo test
#[builder(setter_prefix = "with")]
#[builder(name = "MyBuilder")]
FooBuilder
struct to build Foo
=> please refer to the new docs/// ...
#[doc = ...]
#[cfg(...)]
#[allow(...)]