async-openai icon indicating copy to clipboard operation
async-openai copied to clipboard

Consider switching to typed-builder

Open kageiit opened this issue 1 year ago • 2 comments

derive_builder lets users create partially initialized models which results in lot more unnecessary boilerplate and needing to deal with errors that can be avoided during compile time instead (using the type state pattern)

typed-builder (https://crates.io/crates/typed-builder) does not allow building models unless all required properties are set

Moving to typed-builder would make the api less error-prone and more ergonomic to use. API compatibility with existing Args structs can also be maintained as a small wrapper layer if desired

kageiit avatar Apr 28 '25 09:04 kageiit

Today I use bon instead of a typed-builder. It has all the same features and even more.

nitkach avatar Apr 29 '25 20:04 nitkach

Bon is fine too as it is compile time checked :)

kageiit avatar Apr 29 '25 20:04 kageiit