diff options
author | Michael Davis | 2023-01-24 17:07:46 +0000 |
---|---|---|
committer | Michael Davis | 2023-01-24 18:50:46 +0000 |
commit | 70887b7378d642226ad5102fbe601fecb225225c (patch) | |
tree | 2de7f9847388e8961e6228b07aa8e5a6d71e4bea /theme.toml | |
parent | b3e9f6233a64bb08dcb87788d5ca54dd25f13a27 (diff) |
Refactor toml::Value->Theme conversion
The `From<Value>` implementation for `Theme` converted the Value to a
string and re-parsed the string to convert it to
`HashMap<String, Value>` which feels a bit wasteful. This change uses
the underlying `toml::map::Map` directly when the value is a table and
warns about the unexpected `Value` shape otherwise.
This is necessary because toml 0.6.0 changes the Display implementation
for Value::Table so that the `to_string` no longer encodes the value as
a Document, just a Value. So the parse of the Value fails to be decoded
as a HashMap.
The behavior for returning `Default::default` matches the previous
code's behavior except that it did not warn when the input Value was
failed to parse.
Diffstat (limited to 'theme.toml')
0 files changed, 0 insertions, 0 deletions