Skip to main content

Module doc_differences

Module doc_differences 

Source
Expand description

Differences from derive_builder

  • Not all derive_builder attributes have been cloned: only the ones that we used.
  • Attributes have been adjusted where possible to be easier to use.
  • It is not necessary to use impl_standard_builder!
  • The appropriate serde attributes are automatically provided on the builder.
  • Every field must have some default behavior specified, or must have the no_default option given. (With derive_builder, no_default is the default, which can result in confusing test failures.)
  • Sub-builders are supported.
  • The cfg attribute can be used to warn when the user tries to provide a value for an compiled-out field.
  • There is (limited) support for generics.
  • The generated documentation is a little better.
  • validate has been renamed to pre_build.
  • There is post_build attribute to replace the pattern where we would rename the build function, make it private, and wrap it.
  • A top-level build_fn does not override the build function on sub-builders.
  • The list builder and map builder patterns are supported via attributes; you don’t need separate macros for them.
  • Builders automatically derive ExtendBuilder, Flattenable, and Builder.
  • The configuration type automatically derives Buildable.
  • Visibility is set more reasonably.
  • For many types, we automatically generate setters or serde code that conforms to our standards.