The `validate` method of `Project` was unused, which is problematic if the attributes are supposed to be validated based on some constraints. The issue is that `Project` provided public construction of its fields with enforcing validation. This change makes `Project`'s attributes private and introduces a smart constructor `new` which is fallible if any of the constraints are not met. The error type was changed to be a vector of errors since all of these errors can be collected for better error reporting. Deserialization also provided a way of constructing a `Project` without ensuring any of the constraints were checked. To prevent this a hand-rolled `Deserialize` is provided that goes through `Project::new`. To access the fields of `Project`, accessor functions are added and all call sites are updated to use them. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett |
||
|---|---|---|
| .. | ||
| examples | ||
| src | ||
| tests | ||
| Cargo.toml | ||