Expand description
scale-type-resolver provides a generic TypeResolver trait which can be implemented for
any type that is capable of being given a type ID and resolving that into information about
how the type is SCALE encoded. This allows libraries like scale-decode to be able to decode
SCALE encoded bytes using either a modern type resolver like scale_info::PortableRegistry,
or using entirely custom type resolvers (which we would need in order decode blocks from pre-V14
metadata).
It’s unlikely that you’d depend on this library directly; more likely you’d depend on a library
like scale-decode which uses and re-exports the TypeResolver trait itself.
This crate is no_std by default and doesn’t require alloc except for tests.
Modules§
- portable_
registry - An implementation and associated things related to
scale_info::PortableRegistry. - visitor
- A concrete
ResolvedTypeVisitorimplementation that allows you to provide closures to configure it. Using this is often a lot easier than implementingResolvedTypeVisitoryourself, but does require an additional dependency and may be a touch less performant.
Structs§
Enums§
- Bits
Order Format - This is a runtime representation of the order that bits will be written
to the specified
BitsStoreFormat. - Bits
Store Format - This is a runtime representation of the store type that we’re targeting. These
are equivalent to the
bitvecstore typesu8,u16and so on. - Primitive
- This is handed to
ResolvedTypeVisitor::visit_primitive(), and denotes the exact shape of the primitive type that we have resolved. - Unhandled
Kind - If any of the
ResolvedTypeVisitormethods are not implemented, thenResolvedTypeVisitor::visit_unhandled()is called, and given an instance of this enum to denote which method was unhandled.
Traits§
- Field
Iter - An iterator over a set of fields.
- Path
Iter - An iterator over the path parts.
- Resolved
Type Visitor - A glorified set of callbacks, exactly one of which will fire depending on the outcome of calling
TypeResolver::resolve_type(). These don’t typically need to be implemented by the user, and instead are implemented internally in egscale-decodeto drive the decoding of types. - TypeId
- A trait representing a type ID.
- Type
Resolver - This trait can be implemented for any type that is capable of describing how some type (identified
by a
TypeResolver::TypeId) is represented in terms of SCALE encoded bytes. - Variant
Iter - An iterator over a set of variants.