(s: Option<&'a Snapshot>, id: &str)
| 204 | } |
| 205 | |
| 206 | pub fn state_from_id<'a, T>(s: Option<&'a Snapshot>, id: &str) -> Result<Option<T>, MigratableError> |
| 207 | where |
| 208 | T: Deserialize<'a>, |
| 209 | { |
| 210 | if let Some(s) = s.as_ref() { |
| 211 | s.snapshots.get(id).map(|s| s.to_state()).transpose() |
| 212 | } else { |
| 213 | Ok(None) |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /// A snapshottable component can be snapshotted. |
| 218 | pub trait Snapshottable: Pausable { |
no test coverage detected