3 ms·
For those who want to use the builder pattern in Rust but don't want to write the boilerplate, I've found the typed-builder crate (https://github.com/idanarye/r
by saghm 8y ago
For those who want to use the builder pattern in Rust but don't want to write the boilerplate, I've found the typed-builder crate (https://github.com/idanarye/rust-typed-builder https://github.com/idanarye/rust-typed-builder) to be an excellent solution. It ensures (at compile time!) that you have initialized all the fields of your struct that are not explicitly marked as having default values.
Disclaimer: I don't have any affiliation with this crate; I'm just a big fan