1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! State management with pluggable persistence backends
//!
//! This crate provides an in-memory state store with optional persistent storage
//! backends. The state store supports key-value storage with type-safe serialization
//! and deserialization of values.
//!
//! # Features
//!
//! * `persistence-sqlite` - SQLite-backed persistence using the `switchy` database library
//! * `persistence-ios` - iOS-specific persistence implementation
//!
//! # Examples
//!
//! Basic usage with `SQLite` persistence:
//!
//! ```rust,no_run
//! # #[cfg(feature = "persistence-sqlite")]
//! # {
//! use hyperchad_state::{StateStore, sqlite::SqlitePersistence};
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Serialize, Deserialize)]
//! struct AppConfig {
//! theme: String,
//! notifications: bool,
//! }
//!
//! # async fn example() -> Result<(), hyperchad_state::Error> {
//! // Create a persistence backend
//! let persistence = SqlitePersistence::new_in_memory().await?;
//!
//! // Create the state store
//! let store = StateStore::new(persistence);
//!
//! // Store a value
//! let config = AppConfig {
//! theme: "dark".to_string(),
//! notifications: true,
//! };
//! store.set("config", &config).await?;
//!
//! // Retrieve a value
//! let loaded: Option<AppConfig> = store.get("config").await?;
//! # Ok(())
//! # }
//! # }
//! ```
pub use *;
pub use StateStore;
/// Errors that can occur when working with state storage