Skip to main content

encode_content

Function encode_content 

Source
pub fn encode_content(codec: u64, payload: &[u8]) -> Vec<u8> 
Expand description

Prefix payload with a multicodec varint so the codec is self-describing. Common codec values: CODEC_IDENTITY (0x00) raw bytes, CODEC_DAG_CBOR (0x71), CODEC_RAW (0x55). Use CODEC_IDENTITY for plain text — backward-compatible with receivers that treat content as raw bytes.