Module ac_node_api::decoder

source ·
Expand description

Decode helper. It was not possible to take the scale-value as crate, because it’s not no_std compatible. Based on https://github.com/paritytech/scale-value/blob/4d30d609dc86cbcf102385bc34ef2c01b8c9bbb1/src/scale_impls/decode.rs

Structs

  • A read-only registry containing types in their portable form for serialization.
  • This represents the ID of a type found in the metadata. A scale info type representation can be converted into this, and we get this back directly when decoding types into Values.
  • Value holds a representation of some value that has been decoded, as well as some arbitrary context.
  • This represents the value of a specific variant from an enum, and contains the name of the variant, and the named/unnamed values associated with it.

Enums

  • An error that can occur when we try to encode or decode to a SCALE bit sequence type.
  • A named or unnamed struct-like, array-like or tuple-like set of values. This is used to represent a range of composite values on their own, or as values for a specific Variant.
  • An error decoding SCALE bytes into a Value.
  • An error encoding a Value into SCALE bytes.
  • A “primitive” value (this includes strings).
  • The underlying shape of a given value.

Functions

  • Encoding and decoding SCALE bytes into a [crate::Value].
  • Decode data according to the TypeId provided. The provided pointer to the data slice will be moved forwards as needed depending on what was decoded.
  • Attempt to encode some [crate::Value<T>] into SCALE bytes, by providing a pointer to the type ID that we’d like to encode it as, a type registry from which we’ll look up the relevant type information, and a buffer to encode the bytes to.
  • Attempt to SCALE Encode a Value according to the TypeId and PortableRegistry provided.

Type Definitions