github idanarye/rust-typed-builder v0.4.0
0.4.0 - 2019-12-13

latest releases: v0.20.1, v0.20.0, v0.19.1...
one day ago

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_code expression 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:
      • doc unhides 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. Implies doc.
      • build_method_doc = "…" replaces the default documentation that will
        be generated for the build() method of the builder type. Implies
        doc.

Changed

  • [BREAKING] Renamed the generated builder type from
    TypedBuilder_BuilderFor_Foo to FooBuilder, for improved ergonomics,
    especially when you enable documentation of the builder type.
    • Generic identifiers were also changed, from TypedBuilder_genericType_x to
      __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_Foo to FooBuilder_Optional), and
      its method name for simpler code.
  • [BREAKING] default_code is 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.

Don't miss a new rust-typed-builder release

NewReleases is sending notifications on new releases.