Skip to content

builder: Replace derive_builder with bon to drop pervasive unwrap()#326

Open
cgwalters wants to merge 1 commit intoyouki-dev:mainfrom
cgwalters:bon
Open

builder: Replace derive_builder with bon to drop pervasive unwrap()#326
cgwalters wants to merge 1 commit intoyouki-dev:mainfrom
cgwalters:bon

Conversation

@cgwalters
Copy link
Copy Markdown
Contributor

derive_builder is very popular, but a key selling point of bon is its usage of typestate to ensure that all required fields are provided.

Using this crate before this change required pretty pervasive usage of unwrap() unnecessarily (or ? in places that otherwise wouldn't need a Result), now with bon it doesn't.

Since this crate is regularly bumping semver anyways, let's make doing so valuable.

Closes: #242

Assisted-by: OpenCode (Claude claude-opus-4-6)

/kind api-change

The project has been ported to bon instead of derive_builder, which ensures objects have the required properties at build time, removing the need for unnecessary `unwrap()`.

derive_builder is very popular, but a key selling point of bon
is its usage of typestate to ensure that all required fields
are provided.

Using this crate before this change required pretty pervasive
usage of `unwrap()` unnecessarily (or `?` in places that
otherwise wouldn't need a `Result`), now with bon it
doesn't.

Since this crate is regularly bumping semver anyways, let's
make doing so valuable.

Closes: youki-dev#242

Assisted-by: OpenCode (Claude claude-opus-4-6)
Signed-off-by: Colin Walters <walters@verbum.org>
@utam0k
Copy link
Copy Markdown
Member

utam0k commented Apr 8, 2026

It seems CI failed. Could you check it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

consider a type state builder

2 participants