Skip to content

Why use generics instead of associated types in Handler definition? #3389

Discussion options

You must be logged in to vote

Both of these things are not actually used by the trait, they exist to work around coherence. Since a type can (from the type system's perspective) implement both Fn(X) and Fn(Y) (the arguments are a generic type for the Fn traits as well, not an associated type), we need the extra generics so all the impls we have for Handler don't conflict with each other.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by chernoivanenkoofficial
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants