Even better if you can also show me the road you took to reach the understanding that HKLT 1) were a thing and 2) you needed to use them.
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Wait, what *are* HKLT? Can you point me to some resources? They sound mightily interesting.
-
https://doc.rust-lang.org/reference/trait-bounds.html#higher-ranked-trait-bounds … https://doc.rust-lang.org/nomicon/hrtb.html … https://stackoverflow.com/questions/35592750/how-does-for-syntax-differ-from-a-regular-lifetime-bound … It's the `for<'a> fn(&'a T) -> &'a K` syntax, so that you can pass around closures that have borrows that are related to its inputs, but detached to the current Item context.
- 3 more replies
New conversation -
-
-
i don't have examples on me but in stylo we almost needed them due to a lack of GATs with lifetimes (you can hack it with for<'a> Trait<'a>)
-
That is precisely the kind of out of the left field use I want to hear about!
End of conversation
New conversation -
-
-
I think you are asking about higher *ranked*, not higher *kinded* which are a different thing. Primer: https://www.stephanboyer.com/post/115/higher-rank-and-higher-kinded-types …
-
Higher kinded would be a lifetime from lifetimes to lifetimes (??). Higher ranked would be a "for any" lifetime.
- 1 more reply
New conversation -
-
-
We needed them in `tracing` (https://github.com/tokio-rs/tracing/blob/master/tracing-subscriber/src/fmt/fmt_layer.rs#L388-L393 …), especially the `LookupSpan` bounds. I don't recall _why_ we ended up needing them; I think
@mycoliza short-circuited that search process for me. -
the trait methods return a struct with a reference to the receiver in it; we need HRTB so that we can bound a generic type parameter with that trait without also being generic over the lifetime
- 1 more reply
New conversation -
-
-
IME, it’s most frequently used for function pointers and Fn* bounds
-
I read it Fn starbound and it just made my day.pic.twitter.com/IWjpjokeRC
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.