mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
[app] Add egui::app::DummyStorage
This commit is contained in:
@@ -77,6 +77,17 @@ pub trait Storage {
|
||||
fn set_string(&mut self, key: &str, value: String);
|
||||
}
|
||||
|
||||
/// Stores nothing.
|
||||
#[derive(Clone, Default)]
|
||||
pub struct DummyStorage {}
|
||||
|
||||
impl Storage for DummyStorage {
|
||||
fn get_string(&self, _key: &str) -> Option<&str> {
|
||||
None
|
||||
}
|
||||
fn set_string(&mut self, _key: &str, _value: String) {}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde_json")]
|
||||
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
|
||||
storage
|
||||
|
||||
Reference in New Issue
Block a user