euv_cli/hmr/struct.rs
1//! HMR preserved-state types.
2
3//!
4//! Serializable bag of state entries captured before a hot reload and
5//! restored after the new module instance mounts.
6
7use super::*;
8
9/// A serializable bag of preserved state entries.
10///
11/// Each entry is a `(key, value)` string pair. The
12/// caller is responsible for serializing non-string
13/// values (numbers, booleans, etc.) to strings before
14/// insertion.
15///
16/// # Wire format
17///
18/// ```json
19/// {"entries": {"k1": "v1", "k2": "v2"}}
20/// ```
21#[derive(Clone, Debug, Default, PartialEq, Eq)]
22pub struct HmrState {
23 /// The preserved entries, keyed by name.
24 pub(crate) entries: HashMap<String, String>,
25}