You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
translator: make target pk and error associated types
This is an annoying breaking change for users of the Translator trait
but I think it greatly improves the ergonomics of using the trait.
Rather than having it be parameterized over 3 types, it is now
parameterized over just one (the "source pk type").
This matches how this trait is used in practice -- you typically have a
miniscript/policy/whatever with a keytype Pk, and you want to use a
translator from Pk to "whatever the translator maps to" with "whatever
error the translator yields". So the only type parameter you really need
to type is Pk; the others are irrelevant, and making the user name and
type them is annoying.
Since this eliminates the need to explicitly write out the error types
except when actually implementing the trait, this also changes a ton of
error types from () to Infallible, which is more efficient and correct.
0 commit comments