Expand description
Helper functions and types to assist with decoding.
type_registry_from_metadatais expected to be used when decoding things from historic runtimes, adding the ability to decode some types from information in the metadata.decode_with_error_tracingis likedecode_with_visitor, but will use a tracing visitor (if theerror-tracingfeature is enabled) to provide more information in the event that decoding fails.
Re-exports§
pub use scale_decode;
Structs§
- Decode
Error Trace - A tracing decode error.
Enums§
- Entry
- This represents either an entry name, or the name of the thing that the entry is in (for instance the name of a pallet or of a Runtime API trait).
Traits§
- Decodable
Values - Implementors of this trait are capable of decoding multiple values from bytes into an output type such as a tuple or fixed size array.
- Encodable
Values - Since
scale_encode::EncodeAsTypeis not dyn safe, this trait is used to iterate through and encode a set of values. - Into
Decodable Values - This can be implemented for any type that can be decoded into in multiple steps via
scale_decode::DecodeAsType. The common use case is to decode some sets of bytes into a tuple of multiple types, step by step. As well as tuples up to size 12, Implementations also exist and arrays. - Into
Encodable Values - This can be implemented for anything that can be encoded in multiple steps into a set of values
via
scale_encode::EncodeAsType. The common use case is to encode a tuple of multiple types, step by step, into bytes. As well as tuples up to size 12, Implementations also exist for Vecs and arrays.
Functions§
- decode_
with_ error_ tracing - Decode some bytes given a type ID and type resolver, and a visitor which decides the output value.
- decode_
with_ visitor - An alias to
scale_decode::visitor::decode_with_visitor. This can be used to decode the byte ranges given back from functions likecrate::extrinsics::decode_extrinsicorcrate::storage::decode_storage_key. Decode data according to the type ID and type resolver provided. The provided pointer to the data slice will be moved forwards as needed depending on what was decoded, and a method on the providedVisitorwill be called depending on the type that needs to be decoded. - type_
registry_ from_ metadata frame_metadata::RuntimeMetadatacontains information about runtime calls and events. This function adds this information into ascale_info_legacy::TypeRegistrywhich can then be referenced by other types. The main types you’ll be able to reference from this set are:- type_
registry_ from_ metadata_ any - This is like
type_registry_from_metadata, except it can be handed the outerframe_metadata::RuntimeMetadataenum and will extract types from it where appropriate (handing back no types for deprecated or modern metadata).