Crate scale_info_legacy

Crate scale_info_legacy 

Source
Expand description

This crate provides a set of types which build on each other. The ultimate goal is to be able to define the necessary type information needed to describe how historic Substrate types are SCALE encoded.

The main types exposed here are as follows:

We also expose an InsertName, which is built by parsing type names like Vec<T> from strings, and used in TypeRegistry::insert() to insert types, and then LookupName, which is built by parsing type names like Vec<T>, [u8; 32] and (bool, u32) and is used to lookup the corresponding type information via TypeRegistry::resolve_type() and similar. Finally, TypeShape is an enum used to describe the shape of the type inserted via TypeRegistry::insert().

This crate, like scale-info, can be used in conjunction with crates like:

  • scale-decode to decode SCALE encoded bytes into custom types based on this type information.
  • scale-encode to SCALE encode custom types into bytes based on this type information.
  • scale-value to SCALE encode or decode from a Value type (a bit like serde_json’s Value type).

Re-exports§

pub use chain_types::ChainTypeRegistry;
pub use insert_name::InsertName;
pub use lookup_name::LookupName;
pub use type_registry::RuntimeApiInput;
pub use type_registry::TypeRegistry;
pub use type_registry_set::TypeRegistrySet;
pub use type_shape::TypeShape;

Modules§

chain_types
This module provides a ChainTypeRegistry, which is constructed by deserializing some data into it. JSON is the expected input format, though in theory others can be used too.
insert_name
This module provides the name used to insert types in a registry.
lookup_name
This module provides a struct, LookupName. This struct represents a single concrete type that can be looked up in the crate::TypeRegistry.
type_registry
This module provides a TypeRegistry, which can be used to store and resolve type information for types based on their names.
type_registry_set
This module provides a TypeRegistrySet, which is constructed from a selection of crate::TypeRegistry’s, and will resolve types by looking through each one in a known order until a match is found. This allows us to compose different sets of types into a single thing which itself also implements scale_type_resolver::TypeResolver.
type_shape
This module provides a TypeShape enum, which describes the shape of a type, or in other words, how it should be SCALE encoded/decoded.