diff options
author | 2022-07-09 18:49:50 +0200 | |
---|---|---|
committer | 2022-07-09 18:49:50 +0200 | |
commit | e548d6c0d5b430b090821e673dc453a24c885fbe (patch) | |
tree | 4fdfb9520ab8b934604e8c986ce8ed9d9216f19d /examples | |
parent | 2065a40f642589134142a740ff4198deaa4c378b (diff) | |
download | iced-e548d6c0d5b430b090821e673dc453a24c885fbe.tar.gz iced-e548d6c0d5b430b090821e673dc453a24c885fbe.tar.bz2 iced-e548d6c0d5b430b090821e673dc453a24c885fbe.zip |
Fix Wasm build of `todos` example
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pure/todos/src/main.rs | 14 | ||||
-rw-r--r-- | examples/todos/src/main.rs | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/examples/pure/todos/src/main.rs b/examples/pure/todos/src/main.rs index c2313035..9a74ea71 100644 --- a/examples/pure/todos/src/main.rs +++ b/examples/pure/todos/src/main.rs @@ -529,25 +529,25 @@ impl SavedState { } async fn load() -> Result<SavedState, LoadError> { - let storage = Self::storage().ok_or(LoadError::FileError)?; + let storage = Self::storage().ok_or(LoadError::File)?; let contents = storage .get_item("state") - .map_err(|_| LoadError::FileError)? - .ok_or(LoadError::FileError)?; + .map_err(|_| LoadError::File)? + .ok_or(LoadError::File)?; - serde_json::from_str(&contents).map_err(|_| LoadError::FormatError) + serde_json::from_str(&contents).map_err(|_| LoadError::Format) } async fn save(self) -> Result<(), SaveError> { - let storage = Self::storage().ok_or(SaveError::FileError)?; + let storage = Self::storage().ok_or(SaveError::File)?; let json = serde_json::to_string_pretty(&self) - .map_err(|_| SaveError::FormatError)?; + .map_err(|_| SaveError::Format)?; storage .set_item("state", &json) - .map_err(|_| SaveError::WriteError)?; + .map_err(|_| SaveError::Write)?; let _ = wasm_timer::Delay::new(std::time::Duration::from_secs(2)).await; diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs index 7bfc2a34..363e3fb8 100644 --- a/examples/todos/src/main.rs +++ b/examples/todos/src/main.rs @@ -576,25 +576,25 @@ impl SavedState { } async fn load() -> Result<SavedState, LoadError> { - let storage = Self::storage().ok_or(LoadError::FileError)?; + let storage = Self::storage().ok_or(LoadError::File)?; let contents = storage .get_item("state") - .map_err(|_| LoadError::FileError)? - .ok_or(LoadError::FileError)?; + .map_err(|_| LoadError::File)? + .ok_or(LoadError::File)?; - serde_json::from_str(&contents).map_err(|_| LoadError::FormatError) + serde_json::from_str(&contents).map_err(|_| LoadError::Format) } async fn save(self) -> Result<(), SaveError> { - let storage = Self::storage().ok_or(SaveError::FileError)?; + let storage = Self::storage().ok_or(SaveError::File)?; let json = serde_json::to_string_pretty(&self) - .map_err(|_| SaveError::FormatError)?; + .map_err(|_| SaveError::Format)?; storage .set_item("state", &json) - .map_err(|_| SaveError::WriteError)?; + .map_err(|_| SaveError::Write)?; let _ = wasm_timer::Delay::new(std::time::Duration::from_secs(2)).await; |