Skip to content

v0.10.0

Choose a tag to compare

@jsdw jsdw released this 10 Nov 15:48
· 28 commits to main since this release
53f411a

0.10.0 - 2023-11-10

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.