Skip to main content

Module codec

Module codec 

Source
Expand description

Minimal SCALE codec for the Polkadot app host-api wire format.

Implements only the primitives used by the protocol: compact integers, strings, bytes, enums (u8 tag), options, results, vectors.

Structs§

Reader

Enums§

DecodeErr

Functions§

encode_compact_u32
SCALE compact integer encode (u32 range).
encode_option_none
Option::None = [0x00].
encode_option_some
Option::Some prefix = [0x01], then caller writes the value.
encode_result_err
Result::Err with inner error.
encode_result_ok
Result::Ok with inner value.
encode_result_ok_void
Result::Ok(void) = [0x00].
encode_string
SCALE string: compact length + UTF-8 bytes.
encode_tag
Enum tag (u8).
encode_var_bytes
Dynamic-length bytes: compact length + raw bytes.
encode_vector_len
Vector: compact count + items (caller encodes each item).