mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Add more puffin profile scopes to eframe (#3330)
* Add puffin profile scopes to the startup and running of eframe * puffin_profiler example: start puffin right away * cargo format let-else statements * More profile scopes * Add some `#[inline]` * Standardize puffin profile scope definitions * standardize again * Silence warning when puffin is disabled
This commit is contained in:
@@ -1158,6 +1158,7 @@ impl Storage for DummyStorage {
|
||||
/// Get and deserialize the [RON](https://github.com/ron-rs/ron) stored at the given key.
|
||||
#[cfg(feature = "ron")]
|
||||
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
|
||||
crate::profile_function!(key);
|
||||
storage
|
||||
.get_string(key)
|
||||
.and_then(|value| match ron::from_str(&value) {
|
||||
@@ -1172,6 +1173,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) {
|
||||
crate::profile_function!(key);
|
||||
match ron::ser::to_string(value) {
|
||||
Ok(string) => storage.set_string(key, string),
|
||||
Err(err) => log::error!("eframe failed to encode data using ron: {}", err),
|
||||
|
||||
Reference in New Issue
Block a user