MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / new_from_state

Method new_from_state

vm-migration/src/lib.rs:135–143  ·  view source on GitHub ↗

Create from state that can be serialized

(state: &T)

Source from the content-addressed store, hash-verified

133
134 /// Create from state that can be serialized
135 pub fn new_from_state<T>(state: &T) -> Result<Self, MigratableError>
136 where
137 T: Serialize,
138 {
139 let state = serde_json::to_string(state)
140 .map_err(|e| MigratableError::Snapshot(anyhow!("Error serialising: {e}")))?;
141
142 Ok(SnapshotData { state })
143 }
144}
145
146/// Data structure to describe snapshot data

Callers

nothing calls this directly

Calls 1

SnapshotClass · 0.85

Tested by

no test coverage detected