Cargo Features

[dependencies]
bon = { version = "3.3.0", default-features = false, features = ["std", "alloc", "implied-bounds", "experimental-overwritable", "experimental-getter"] }
default = std

The std feature is set by default whenever bon is added without default-features = false somewhere in the dependency tree.

std default = alloc
alloc std
implied-bounds

See the explanation of what this feature does in the docs here: https://bon-rs.com/guide/typestate-api/custom-methods#implied-bounds

Enables implied-bounds of bon-macros

The version of the macro crate is pinned to a specific one because the code generated by the macros uses private APIs from the runtime crate that are not guarded by semver.

experimental-overwritable

🔬 Experimental! There may be breaking changes to this feature between minor releases, however, compatibility within patch releases is guaranteed though.

This feature enables the #[builder(overwritable)] attribute that can be used to allow overwriting already set fields in the builder. Without this attribute it's not possible to set the same member twice in the builder, a compile error would be generated.

See more info at https://bon-rs.com/reference/builder/top-level/overwritable.

We are considering stabilizing this attribute if you have a use for it. Please leave a 👍 reaction under the issue https://github.com/elastio/bon/issues/149 if you need this attribute. It would also be cool if you could leave a comment under that issue describing your use case for it.

Enables experimental-overwritable of bon-macros

experimental-getter

🔬 Experimental! There may be breaking changes to this feature between minor releases, however, compatibility within patch releases is guaranteed though.

This feature enables the #[builder(getter)] attribute that can be used to allow getting references to already set fields in the builder.

See more info at https://bon-rs.com/reference/builder/member/getter.

The fate of this feature depends on your feedback in the tracking issue https://github.com/elastio/bon/issues/225. Please, let us know if you have any ideas how to make this attribute better, or if it's already good enough!

Enables experimental-getter of bon-macros