programming/rust.org
... ...
@@ -29,6 +29,13 @@ This way we can easily check if a config file is compatible with our parser.
29 29
30 30
It is also interesting to separate the config structure+parser in a crate, so we can use it's version exclusively for this.
31 31
32
+**** Trick for checking the version of a unknown file
33
+:PROPERTIES:
34
+:CREATED: [2024-05-13 Mon 23:58]
35
+:END:
36
+
37
+Create a struct with just the =version= field, and without =#[serde(deny_unknown_fields)]=, so it can "extract" the version field safely from a file that you don't know the rest of its structure and discard the rest.
38
+
32 39
* Embedded Rust
33 40
** General Reminders
34 41