Generate the state data from the snapshot data
(&'a self)
| 124 | impl SnapshotData { |
| 125 | /// Generate the state data from the snapshot data |
| 126 | pub fn to_state<'a, T>(&'a self) -> Result<T, MigratableError> |
| 127 | where |
| 128 | T: Deserialize<'a>, |
| 129 | { |
| 130 | serde_json::from_str(&self.state) |
| 131 | .map_err(|e| MigratableError::Restore(anyhow!("Error deserialising: {e}"))) |
| 132 | } |
| 133 | |
| 134 | /// Create from state that can be serialized |
| 135 | pub fn new_from_state<T>(state: &T) -> Result<Self, MigratableError> |
no outgoing calls
no test coverage detected