logoalt Hacker News

Maxataryesterday at 6:58 PM2 repliesview on HN

If you need to store the value then you have no choice but to take in a dyn trait.


Replies

steveklabnikyesterday at 7:05 PM

Depending on exactly what you mean, this isn't correct. This syntax is the same as <T: BarTrait>, and you can store that T in any other generic struct that's parametrized by BarTrait, for example.

show 1 reply
tcfhgjyesterday at 7:05 PM

sure about that?

the struct in which it is stored, could be generic as well

show 1 reply