MCPcopy Create free account
hub / github.com/argumentcomputer/ix / deser_source_info

Function deser_source_info

crates/ixon/src/metadata.rs:409–435  ·  view source on GitHub ↗
(
  buf: &mut &[u8],
  ixon_env: &super::env::Env,
)

Source from the content-addressed store, hash-verified

407 }
408 }
409 Ok(())
410 }
411
412 /// Self-contained encoding: name references as raw 32-byte addresses,
413 /// no index required. This is the demoted in-memory form
414 /// (see `env::DEMOTE`), NOT the `.ixe` named-section encoding —
415 /// `Env::put` re-encodes through the name index.
416 pub fn put_raw(&self, buf: &mut Vec<u8>) -> Result<(), String> {
417 self.put_with(NamePut::Raw, buf)
418 }
419
420 /// Decode the [`Self::put_raw`] encoding.
421 pub fn get_raw(buf: &mut &[u8]) -> Result<Self, String> {
422 Self::get_with(buf, NameGet::Raw)
423 }
424
425 /// Delegate indexed deserialization, then deserialize extension tables.
426 pub fn get_with(buf: &mut &[u8], rev: NameGet<'_>) -> Result<Self, String> {
427 let info = ConstantMetaInfo::get_with(buf, rev)?;
428 // Extension tables: always present (put_with always writes them,
429 // even when empty — three zero-length vectors).
430 let sharing_len = get_vec_len(buf)?;
431 let mut meta_sharing = Vec::with_capacity(sharing_len);
432 for _ in 0..sharing_len {
433 meta_sharing.push(get_expr(buf)?);
434 }
435 let refs_len = get_vec_len(buf)?;
436 let mut meta_refs = Vec::with_capacity(refs_len);
437 for _ in 0..refs_len {
438 meta_refs.push(get_address_raw(buf)?);

Callers 1

deser_syntaxFunction · 0.85

Calls 3

deser_u8Function · 0.85
deser_substringFunction · 0.85
deser_tag0Function · 0.85

Tested by

no test coverage detected