Skip to content

What's the purpose of T in Handler? #3024

Answered by mladedav
dominickpastore asked this question in Q&A
Discussion options

You must be logged in to vote

Feel free to play around with the code. You can try deleting it and see what happens. And honestly, I'd recommend doing just that because I'm not sure how much the following will make sense without you playing with the code.

The main reason is that we're creating multiple blanket implementations for the trait, one for F: Fn(), one for F: Fn(T1), one for F: Fn(T1, T2), etc. Normally, that wouldn't be possible because rustc would see that as conflicting implementations so we need to convince it it's actually slightly different traits. See this example, it might better show you what I'm trying to get across, the commented out code wouldn't work.

The second part of that parameter is usually n…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dominickpastore
Comment options

Answer selected by jplatte
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