MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / deserialize

Method deserialize

ciphercore-base/src/graphs.rs:4586–4604  ·  view source on GitHub ↗
(deserializer: D)

Source from the content-addressed store, hash-verified

4584
4585impl<'de> Deserialize<'de> for Context {
4586 fn deserialize<D>(deserializer: D) -> std::result::Result<Context, D::Error>
4587 where
4588 D: Deserializer<'de>,
4589 {
4590 let versioned_context = VersionedData::deserialize(deserializer)?;
4591 if !versioned_context.check_version(DATA_VERSION) {
4592 Err(runtime_error!(
4593 "Context version doesn't match the requirement"
4594 ))
4595 .map_err(serde::de::Error::custom)
4596 } else {
4597 let serializable_context =
4598 serde_json::from_str::<SerializableContext>(versioned_context.get_data_string())
4599 .expect("Error during deserialization of SerializableContext");
4600 serializable_context
4601 .recover_original_context()
4602 .map_err(serde::de::Error::custom)
4603 }
4604 }
4605}
4606
4607/// In general, `create_unchecked_context()` should not return errors, but

Callers

nothing calls this directly

Calls 3

check_versionMethod · 0.80
get_data_stringMethod · 0.80

Tested by

no test coverage detected