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

Method put

crates/ixon/src/proof.rs:335–363  ·  view source on GitHub ↗

Serialize: mask (Tag0) + field values in mask order.

(&self, buf: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

333 buf.push(u8::from(b));
334}
335
336fn get_bool_field(buf: &mut &[u8]) -> Result<bool, String> {
337 match get_u8(buf)? {
338 0 => Ok(false),
339 1 => Ok(true),
340 x => Err(format!("get_bool_field: invalid {x}")),
341 }
342}
343
344// ============================================================================
345// RevealConstructorInfo serialization
346// ============================================================================
347
348impl RevealConstructorInfo {
349 /// Serialize: mask (Tag0) + field values in mask order.
350 pub fn put(&self, buf: &mut Vec<u8>) {
351 let mask = compute_mask(&[
352 self.is_unsafe.is_some(),
353 self.lvls.is_some(),
354 self.cidx.is_some(),
355 self.params.is_some(),
356 self.fields.is_some(),
357 self.typ.is_some(),
358 ]);
359 Tag0::new(mask).put(buf);
360 if let Some(u) = self.is_unsafe {
361 put_bool_field(u, buf);
362 }
363 if let Some(l) = self.lvls {
364 Tag0::new(l).put(buf);
365 }
366 if let Some(c) = self.cidx {

Callers 13

put_rulesFunction · 0.45
put_ctorsFunction · 0.45
commitMethod · 0.45
claim_roundtripFunction · 0.45
proof_roundtripFunction · 0.45
reveal_info_roundtripFunction · 0.45
claim_tagFunction · 0.45
proof_tagFunction · 0.45
claim_bytesFunction · 0.45
test_proof_first_byteFunction · 0.45
test_reveal_defn_safetyFunction · 0.45
test_reveal_defn_typFunction · 0.45

Calls 13

compute_maskFunction · 0.85
put_bool_fieldFunction · 0.85
put_def_kindFunction · 0.85
put_def_safetyFunction · 0.85
put_ctorsFunction · 0.85
put_rulesFunction · 0.85
put_quot_kindFunction · 0.85
put_opt_addrFunction · 0.85
as_bytesMethod · 0.80
pushMethod · 0.80
proof_variant_sizeMethod · 0.80
is_emptyMethod · 0.45

Tested by 4

test_proof_first_byteFunction · 0.36
test_reveal_defn_safetyFunction · 0.36
test_reveal_defn_typFunction · 0.36