philbooth · GitHub

Extracts the inline validation code from the settings module to a
dedicated deserialize module, so that the validation rules can be better
re-used elsewhere.
Uses functions rather than newtype structs, for 2 reasons:
1. There's an issue in the config crate where newtype structs aren't
   deserialized. An unmerged PR exists to fix it, but in the meantime
   this changeset works round the problem.
2. When using newtype structs, the tests aren't able to create fresh
   instances of the Settings struct unless it is flattened to a single
   level.
Maybe we can revisit the newtype struct approach down the line when both
of the above are resolved.

@philbooth

requested a review from rfk

May 3, 2018 18:13

Closed

rfk

rfk approved these changes May 4, 2018

@philbooth

@philbooth

philbooth deleted the pb/deserialize-without-types branch

May 4, 2018 05:28

Read the original on github.com ↗