- Rust Standard Library Cookbook
- Jan Nils Ferner Daniel Durante
- 52字
- 2021-08-27 19:45:04
There's more...
If you want your object to be constructable without a builder, you could also provide Burger with a Default implementation. BurgerBuilder::new() could then just return Default::default().
In build(), if your configuration can inherently not be invalid, you can, of course, return the object directly without wrapping it in a Result.