Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider exposing optional name/path of variant/composite types #4

Open
jsdw opened this issue Mar 4, 2024 · 0 comments
Open

Consider exposing optional name/path of variant/composite types #4

jsdw opened this issue Mar 4, 2024 · 0 comments

Comments

@jsdw
Copy link
Collaborator

jsdw commented Mar 4, 2024

In scale_info::PortableRegistry we can obtain the path of composite and variant types. This isn't relevant for normal encoding and decoding, but may be useful in a couple of other scenarios:

  • If I make a custom type with custom encoding/decoding in order to mirror some Substrate type, I may want to be able to check in the EncodeAsType/DecodeAsType impls that the target type has the expected name (ie is likely to have led to the same custom encoding/decoding).
  • I may want to be able to return the target type name/path in errors.

This information is not mandatory and so I think it should be optional whether a TypeResolver implementation provides it or not (ie for V14 types, we can always provide it, but for older types it may be easier if the user doesn't have to provide such information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant