Skip to content

Commit

Permalink
eframe: don't prettify presisted ron strings (#902)
Browse files Browse the repository at this point in the history
What ultimately ends up stored into a file is the
HashMap<String, String>, which when prettified only nets three
(depending on the settings) lines of "string": "long prettified
string that's really hard to read because of the extra indentation and
literal \n characters that are all just on one single line".

Not prettifying the values in the first place makes it somewhat easier
to read and also saves a bit of space.
  • Loading branch information
AlexChaplinBraz authored Nov 28, 2021
1 parent 9d56bce commit 224d4d6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions epi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,7 @@ pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &st
/// Serialize the given value as [RON](https://github.com/ron-rs/ron) and store with the given key.
#[cfg(feature = "ron")]
pub fn set_value<T: serde::Serialize>(storage: &mut dyn Storage, key: &str, value: &T) {
storage.set_string(
key,
ron::ser::to_string_pretty(value, Default::default()).unwrap(),
);
storage.set_string(key, ron::ser::to_string(value).unwrap());
}

/// [`Storage`] key used for app
Expand Down

0 comments on commit 224d4d6

Please sign in to comment.