No more worrying whether the build call on your builder will return Ok or not. Maybe you forgot to set a field? typesafe-builders solves this by using the Rust type-system to ensure correct usage.
Example
use *;
Field Attributes
All attributes must be wrapped in a builder, eg. builder(optional).
optional- A field can be set, but is not required to.constructor- A field must already be set in thebuilderfunction.
How does it work?
Const generic one-hot bitfields. What you get is similar to this:
// The build function is only available once all fields are set:
TODOs
- Add
optionalfields. - Add
renamefield attribute. - Add
constructoror something like this to have mandatory args directly in thebuilderfunction. - Add
Intoor whatever to cast types. - Add way to pass options as
Someautomatically. - Cleanup