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

Prep for 0.10 release #42

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Prep for 0.10 release #42

merged 1 commit into from
Nov 10, 2023

Conversation

jsdw
Copy link
Collaborator

@jsdw jsdw commented Nov 10, 2023

This release changes IntoVisitor to require that the corresponding Visitor implements scale_decode::Error, rather than allowing the error to be anything that can be converted into a scale_decode::Error. This has the following advantages:

  • It makes DecodeAsType a proper super-trait of IntoVisitor, meaning it can be used anywhere IntoVisitor is. Previously, using DecodeAsType in some places also required that you add a bound like B: IntoVisitor, <B::Visitor as Visitor>::Error: Into<scale_decode::Error, ie the Error type needed to explicitly be declared as convertible in the way that DecodeAsType requires.
  • It simplifies the code.
  • It makes it a bit easier to understand how to correctly make a type implement DecodeAsType.

The main drawback is that if your Visitor implementation doesn't have Error = scale_decode::Error, then it can no longer be used with IntoVisitor. To work around this, a new adapter type, scale_decode::visitor::VisitorWithCrateError(your_visitor) has been added; any visitor wrapped in this type whose error implements Into<scale_decode::Error> will now implement Visitor with Error = scale_decode::Error.

@jsdw jsdw merged commit 53f411a into main Nov 10, 2023
7 checks passed
@jsdw jsdw deleted the release-v0.10.0 branch November 10, 2023 15:03
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

Successfully merging this pull request may close these issues.

3 participants