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

Function put_opt_addr

crates/ixon/src/proof.rs:951–959  ·  view source on GitHub ↗

Helper: write an `Option ` as `[0x00]` (None) or `[0x01][addr:32]` (Some). Single byte for absence avoids a 33-byte gap when assumptions are absent.

(opt: &Option<Address>, buf: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

949
950fn validator_for_variant(variant: u64) -> u8 {
951 match variant {
952 VARIANT_REVEAL_CLAIM | VARIANT_CONTAINS_CLAIM => 0,
953 VARIANT_RESOURCE_CLAIM => 2,
954 _ => 1,
955 }
956}
957fn put_scope(validator: u8, buf: &mut Vec<u8>) {
958 buf.extend_from_slice(&[3, validator]);
959}
960fn get_scope(validator: u8, buf: &mut &[u8]) -> Result<(), String> {
961 if get_u8(buf)? != 3 {
962 return Err("claim: unsupported object format".into());

Callers 1

putMethod · 0.85

Calls 2

pushMethod · 0.80
as_bytesMethod · 0.80

Tested by

no test coverage detected