mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-21 10:30:41 +08:00
adaed6a3ac4232b96e7ec93882821f75a9118adb
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
❤️🪵
Radicle Heartwood Protocol & Stack
Languages
Rust
97.8%
Shell
0.5%
CUE
0.4%
Nix
0.3%
Just
0.3%
Other
0.6%