typed-builder
Compile-time type-checked builder derive
0.23.2
98M downloads/mo
#817 most downloaded on crates.io
idanarye/rust-typed-builder
What this package is like to depend on
Last release 9 months ago
19 Nov 2025
Release timing varies
gaps range from 8 days to 7 months
Nearly every release is documented
notes for 39 of 40 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
40 releases · first in 2017
4 releases in the last 12 months
see the full history below
Release timeline
40 releases · Oct 2017 to Nov 2025
2018
2019
2020
2021
2022
2023
2024
2025
2026
Releases
latest 40-
0.23.219 Nov 2025 -
0.23.116 Nov 2025Release notes
Open source →Fixed
- Clippy warnings for unused variables in the new default implementation.
Release notes
Open source →Fixed
- Clippy warnings for unused variables in the new default implementation.
-
0.23.020 Oct 2025Release notes
Open source →Changed
- Upgrae Rust edition to 2024.
- [BREAKING] When
defaultis an expression that uses previous fields,
it'll receive them as reference.
Added
default_whereoption to add generic bounds ondefault.builder_type(attributes(...))for adding attributes to the builder type
(mainly forderive)
Removed
- [BREAKING] The
Optionaltrait. This is an internal implementation
detail, but some users may have relied on it for customized flows.
Release notes
Open source →Changed
- Upgrae Rust edition to 2024.
- [BREAKING] When
defaultis an expression that uses previous fields, it'll receive them as reference.
Added
default_whereoption to add generic bounds ondefault.builder_type(attributes(...))for adding attributes to the builder type (mainly forderive)
Removed
- [BREAKING] The
Optionaltrait. This is an internal implementation detail, but some users may have relied on it for customized flows.
-
0.22.014 Sep 2025Release notes
Open source →Added
- New optional alternate
transformsyntax using a full fn, to allow support for custom lifetimes, generics and a where clause to custom builder method.
Example:
#[derive(TypedBuilder)] struct Foo { #[builder( setter( fn transform<'a, M>(value: impl IntoValue<'a, String, M>) -> String where M: std::fmt::Display { value.into_value() }, ) )] s: String, }
Release notes
Open source →Added
- New optional alternate
transformsyntax using a full fn, to allow support for custom lifetimes, generics and a where clause to custom builder method.
Example:
#[derive(TypedBuilder)] struct Foo { #[builder( setter( fn transform<'a, M>(value: impl IntoValue<'a, String, M>) -> String where M: std::fmt::Display { value.into_value() }, ) )] s: String, } - New optional alternate
-
0.21.221 Aug 2025 -
0.21.112 Aug 2025Release notes
Open source →Fixed
- Strip raw ident prefix from base method name before assembling prefixed/suffixed fallback method names
Release notes
Open source →Fixed
- Strip raw ident prefix from base method name before assembling prefixed/suffixed fallback method names
-
0.21.020 Mar 2025Release notes
Open source →Added
- Added
ignore_invalidoption tostrip_optionto skip stripping for non-Option fields - Added
fallback_prefixandfallback_suffixoptions tostrip_optionfor customizing fallback method names - Added support for field defaults with
strip_optionand its fallback options
Changed
- Improved handling of
strip_optionto work better with field defaults - Made
strip_optionmore flexible with non-Option fields whenignore_invalidis set
Release notes
Open source →Added
- Added
ignore_invalidoption tostrip_optionto skip stripping for non-Option fields - Added
fallback_prefixandfallback_suffixoptions tostrip_optionfor customizing fallback method names - Added support for field defaults with
strip_optionand its fallback options
Changed
- Improved handling of
strip_optionto work better with field defaults - Made
strip_optionmore flexible with non-Option fields whenignore_invalidis set
- Added
-
0.20.114 Mar 2025Release notes
Open source →Fixed
- Fix mutator with type parameter using associated type (see issue #157)
Release notes
Open source →Fixed
- Fix mutator with type parameter using associated type (see issue #157)
-
0.20.022 Aug 2024Release notes
Open source →Added
- Add
#[builder(setter(strip_option(fallback = field_opt)))]to add a fallback unstripped method to the builder struct. - Add
#[builder(setter(strip_bool(fallback = field_bool)))]to add a fallback setter that takes theboolvalue to the builder struct.
Release notes
Open source →Added
- Add
#[builder(setter(strip_option(fallback = field_opt)))]to add a fallback unstripped method to the builder struct. - Add
#[builder(setter(strip_bool(fallback = field_bool)))]to add a fallback setter that takes theboolvalue to the builder struct.
- Add
-
0.19.114 Jul 2024 -
0.18.216 Apr 2024 -
0.18.116 Jan 2024Release notes
Open source →Fixed
- Add
#[allow(clippy::no_effect_underscore_binding)]to generated methods that need to destructure intermediate builder state. - Use a proper
ORsyntax for the dual license.
- Add
-
0.18.019 Oct 2023 -
0.17.015 Oct 2023Release notes
Open source →Changed
- Internal refactor of attribute parsing - results in better error messages and easier proces for adding new settings.
Added
#[builder(mutators(...))]to generate functions on builder to mutate fields#[builder(via_mutator)]on fields to allow defining fields initialized during::builder()for use withmutatorsmutable_during_default_resolutionto allowdefaultexpression mutate previous fields.
Fixed
- Add support for paths with angle brackets (see PR #122 )
-
0.16.221 Sep 2023Release notes
Open source →Fixed
- Use generics with the constructor in
buildmethod (see issue #118)
- Use generics with the constructor in
-
0.16.118 Sep 2023Release notes
Open source →Fixed
- Add
#[allow(clippy::exhaustive_enums)]to generated empty enums used for error "reporting" (see issue #112) - Add
#[automatically_derived]to generatedimpls (see issue #114) - Add
#[allow(clippy::used_underscore_binding)]to build method and setter methods (see issue #113)
- Add
-
0.16.026 Aug 2023Release notes
Open source →Added
#[builder(crate_module_path = ...)]for overcoming cases where the derive macro is used in another crate's macro (see issue #109)
-
0.15.203 Aug 2023Release notes
Open source →Fixed
- Fix const generics generating "empty" entries in some lists, resulting in consecutive commas (see issue #106)
-
0.15.110 Jul 2023 -
0.15.005 Jul 2023Release notes
Open source →Changed
- [BREAKING] Split the derive macro out to a separate procmacro crate. This is considered a breaking change because reexporting and/or renmaing the crate can now prevent the generated code from finding the types it needs (see issue #101)
Fixed
- Marking a field as
#[deprecated]now behaves properly -TypedBuildergenerated code itself does trigger the deprecation warning, and instead the setter for that field now does. - The "fake"
buildmethod when required fields are not provided now returns the never type ("!"). Refer to PR #97 for more thorough explanation.
Added
- Support for setter method prefixes and suffixes
#[builder(field_defaults(setter(prefix = "...", suffix = "...")))]. This either prepends or appends the provided string to the setter method. This allows method names like:set_x(),with_y(), orset_z_value().
-
0.14.008 Mar 2023 -
0.13.005 Mar 2023Release notes
Open source →Changed
y
- [BREAKING] Builder state parameter moved to the end of the generated builder type's parameters list.
- Generated builder type's builder state parameter now defaults to tuple of empty tuples. This means the empty builder, where no parameter is yet set.
Fixed
#[builder(build_method(...))]now affects the fakebuildmethod that's generated to add information to the compiler error.
-
0.12.029 Jan 2023Release notes
Open source →Removed
- [BREAKING]
builder_method_doc = "...",builder_type_doc = "..."andbuild_method_doc = "..."are replaced withbuilder_method(doc = "..."),builder_type(doc = "...")andbuild_method(doc = "...").
Added
build_method(...)now has adocfield.builder_method(...)andbuilder_type(...), which are structured similarly tobuild_method(...).
- [BREAKING]
-
0.11.029 Oct 2022Release notes
Open source →Added
#[builder(build_method(vis="pub", name=build))]for customizing visibility and fn name of the final build method (the default visibility ispub, and default build name isbuild)
-
0.10.013 Feb 2022Release notes
Open source →Added
#[builder(setter(strip_bool))]for making zero arguments setters forboolfields that just set them totrue(thedefaultautomatically becomesfalse)
-
0.9.103 Sep 2021Release notes
Open source →Fixed
- Add
extern crate proc_macro;to solve some weird problem (https://github.com/idanarye/rust-typed-builder/issues/57) - Use unambiguous
::prefixed absolute paths in generated code.
- Add
-
0.9.031 Jan 2021Release notes
Open source →Added
- Builder type implements
Clonewhen all set fields support clone. #[builder(setter(transform = ...))]attribute for running a transform on a setter's argument to convert them to the field's type.
Fixed
- Fix code generation for raw identifiers.
- Builder type implements
-
0.8.006 Dec 2020Release notes
Open source →Changed
- Upgraded the Rust edition to 2018.
Added
#[field_defaults(...)]attribute for settings default attributes for all the fields.
-
0.7.120 Nov 2020 -
0.7.023 Jul 2020Release notes
Open source →Added
- Brought back
default_code, because it needed to resolve conflict with other custom derive proc-macro crates that try to parse[#builder(default = ...)]attribute in order to decide if they are relevant to them - and fail because the expect them to be simple literals.
- Brought back
-
0.6.017 May 2020Release notes
Open source →Added
- Ability to use
intoandstrip_optionsimultaneously for a field.
Changed
- [BREAKING] Specifying
skiptwice in the samebuilder(setter(...))is no longer supported. Then again, if you were doing that you probably deserve having your code broken.
- Ability to use
-
0.5.126 Jan 2020Release notes
Open source →Fixed
- Prevent Clippy from warning about the
panic!()in the faux build method.
- Prevent Clippy from warning about the
-
0.5.025 Jan 2020Release notes
Open source →Changed
- [BREAKING] Move
docandskipinto a subsetting namedsetter(...). This means that#[builder(doc = "...")], for example, should now be written as#[builder(setter(doc = "..."))]. - [BREAKING] Setter arguments by default are no longer automatically
converted to the target type with
into(). If you want to automatically convert them, use#[builder(setter(into))]. This new default enables rustc inference for generic types and proper integer literal type detection. - Improve build errors for incomplete
.build()and repeated setters, by creating faux methods with deprecation warnings.
Added
#[builder(setter(strip_option))]for making setters forOptionfields automatically wrap the argument withSome(...). Note that this is a weaker conversion than#[builder(setter(into))], and thus can still support type inference and integer literal type detection.
Removed
- [BREAKING] Removed the
default_codesetting (#[builder(default_code = "...")]) because it is no longer required now that Rust andsynsupport arbitrary expressions in attributes.
- [BREAKING] Move
-
0.4.117 Jan 2020Release notes
Open source →Fixed
- [BREAKING] now state types are placed before original generic types.
Previously, all state types are appended to generic arguments. For example,
Foo<'a, X, Y>yieldsFooBuilder<'a, X, Y, ((), ())>previously, and now it becomesFooBuilder<'a, ((), ()), X, Y, >.. This change fix compiler error for struct with default type likeFoo<'a, X, Y=Bar>. Rust only allow type parameters with a default to be trailing.
- [BREAKING] now state types are placed before original generic types.
Previously, all state types are appended to generic arguments. For example,
-
0.4.012 Dec 2019Release notes
Open source →Added
#![no_std]is now supported out of the box. (You don't need to opt into any features, it just works.)- [BREAKING] a
default_codeexpression can now refer to the values of earlier fields by name (This is extremely unlikely to break your code, but could in theory due to shadowing) #[builder(skip)]on fields, to not provide a method to set that field.- Control of documentation:
#[builder(doc = "…")]on fields, to document the field's method on the builder. Unlike#[doc], you can currently only have one value rather than one attribute per line; but that's not a big deal since you don't get to use the///sugar anyway. Just use a multiline string.#[builder(doc, builder_method_doc = "…", builder_type_doc = "…", build_method_doc = "…")]on structs:docunhides the builder type from the documentation.builder_method_doc = "…"replaces the default documentation that will be generated for the builder() method of the type for which the builder is being generated.builder_type_doc = "…"replaces the default documentation that will be generated for the builder type. Impliesdoc.build_method_doc = "…"replaces the default documentation that will be generated for the build() method of the builder type. Impliesdoc.
Changed
- [BREAKING] Renamed the generated builder type from
TypedBuilder_BuilderFor_FootoFooBuilder, for improved ergonomics, especially when you enable documentation of the builder type.- Generic identifiers were also changed, from
TypedBuilder_genericType_xto__x. This is still expected to avoid all name collisions, but is easier to read in the builder type docs if you enable them. - Renamed the conversion helper trait for documentation purposes
(
TypedBuilder_conversionHelperTrait_FootoFooBuilder_Optional), and its method name for simpler code.
- Generic identifiers were also changed, from
- [BREAKING]
default_codeis now lazily evaluated instead of eagerly; any side-effects that there might have been will no longer occur. As is usual in this release, this is very unlikely to affect you. - The restriction that there be only one
#[builder]attribute per field has been lifted. You can now write#[builder(skip)] #[builder(default)]instead of#[builder(skip, default)]if you want to. As was already the case, latest definition wins. - [BREAKING] Use a single generic parameter to represent the builder type's state (see issue #21). Previously we would use a parameter for each field.
Changed
- Move to dual license - MIT/Apache-2.0. Previously this project was just MIT.
-
0.3.019 Feb 2019Release notes
Open source →Added
#[builder(default_code = "...")]syntax for defaults that cannot be parsed as attributes no matter what.
Changed
- Move the docs from the crate to the custom derive proc macro.
-
0.2.006 Feb 2019Release notes
Open source →Changed
- Upgraded
synversion to support Rust 2018. - [BREAKING] Changed attribute style to
#[builder(...)]:#[default]->#[builder(default)]#[default=...]->#[builder(default=...)]
- [BREAKING]
defaultno longer needs to be a string.- But you need to change your code anyways because the attribute style was changed.
- Upgraded
-
0.1.125 Jul 2018 -
0.1.005 Oct 2017Release notes
Open source →Added
- Custom derive for generating the builder pattern.
- All setters are accepting
Intovalues. - Compile time verification that all fields are set before calling
.build(). - Compile time verification that no field is set more than once.
- Ability to annotate fields with
#[default]to make them optional and specify a default value when the user does not set them. - Generates simple documentation for the
.builder()method.
-
0.0.004 Oct 2017Nothing published for this version