logoalt Hacker News

reactordevtoday at 12:59 PM1 replyview on HN

But that trait can’t have fields


Replies

scuff3dtoday at 3:53 PM

You can use a struct that the other structs have as a field. The trait can then operate on that struct.

I'm not trying to convince you to use Rust. If you prefer C++ have at it. I was just trying to point out that most patterns in C++ have a fairly close analogy in Rust, just with different tradeoffs.

show 1 reply