builder-pattern
builder-pattern copied to clipboard
Provide meaningful compile error when build fails
When the required fields are not properly provided, the compiler cannot deduce the build function. In that time, the compile error message would be like this:
no method named `build` found for struct `TestBuilder<...>` in the current scope
It will be helpful that the compiler suggests missing required fields like this:
Cannot build `Test` because following fields are required:
- name: String
- age: u8
It may be easily implemented if the Specialization feature is implemented, but the feature is not stable.