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

Function put_name

crates/ixon/src/serialize.rs:898–917  ·  view source on GitHub ↗

Serialize a Name to bytes (full recursive serialization, for standalone use).

(name: &Name, buf: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

896 pub fn put(&self, buf: &mut Vec<u8>) {
897 put_u64(self.idx, buf);
898 put_u64(self.cidx, buf);
899 put_address(&self.block, buf);
900 }
901
902 pub fn get(buf: &mut &[u8]) -> Result<Self, String> {
903 let idx = get_u64(buf)?;
904 let cidx = get_u64(buf)?;
905 let block = get_address(buf)?;
906 Ok(ConstructorProj { idx, cidx, block })
907 }
908}
909
910impl RecursorProj {
911 pub fn put(&self, buf: &mut Vec<u8>) {
912 put_u64(self.idx, buf);
913 put_address(&self.block, buf);
914 }
915
916 pub fn get(buf: &mut &[u8]) -> Result<Self, String> {
917 let idx = get_u64(buf)?;
918 let block = get_address(buf)?;
919 Ok(RecursorProj { idx, block })
920 }

Callers 1

test_name_roundtripFunction · 0.85

Calls 5

as_dataMethod · 0.80
as_bytesMethod · 0.80
put_u8Function · 0.70
put_u64Function · 0.70
lenMethod · 0.45

Tested by 1

test_name_roundtripFunction · 0.68