Closed bdarcus closed 1 year ago
Change to camel case, but snake case values (for enums).
untagged
Use serde untagged here and elsewhere.
https://github.com/bdarcus/csln/blob/0433e8d6161ead8e51accfeaf9533b560da3d9b6/src/style/template.rs#L26-L31
The last two are related:
First , handle default values, be liberal in setting them, and getting rid of Option on fields:
Option
https://graham.cool/schemars/deriving/attributes/#default
https://serde.rs/container-attrs.html#default
https://cj.rs/blog/rust-default-values-for-maintainability/
Example:
impl Default for Style { fn default() -> Self { Self { foreground: 0.4, background: 0.8, ...etc... } }
Second:
Get rid of unwrap etc.
https://dmerej.info/blog/post/killing-unwrap/
The first automatically obviates need for this, but for those that remain, use other options like ?.
?
property names
Change to camel case, but snake case values (for enums).
use
untagged
Use serde
untagged
here and elsewhere.https://github.com/bdarcus/csln/blob/0433e8d6161ead8e51accfeaf9533b560da3d9b6/src/style/template.rs#L26-L31
default values
The last two are related:
First , handle default values, be liberal in setting them, and getting rid of
Option
on fields:https://graham.cool/schemars/deriving/attributes/#default
https://serde.rs/container-attrs.html#default
https://cj.rs/blog/rust-default-values-for-maintainability/
Example:
Second:
Get rid of unwrap etc.
https://dmerej.info/blog/post/killing-unwrap/
The first automatically obviates need for this, but for those that remain, use other options like
?
.