mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 06:10:06 -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);
|
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")]
|
#[cfg(feature = "serde_json")]
|
||||||
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
|
pub fn get_value<T: serde::de::DeserializeOwned>(storage: &dyn Storage, key: &str) -> Option<T> {
|
||||||
storage
|
storage
|
||||||
|
|||||||
Reference in New Issue
Block a user