I am sure this is a question that has been answered multiple times, but I cannot find a straightforward answer anywhere. If this has been answered, a simple link would be great. Thanks for the patience!
I have two unrelated structs, call them Cat
and Dog
. And I have a couple common traits that define shared behavior.
Some of that shared behavior are a list of state properties (fur_color, eye_color, etc).
I have implemented the traits for each Cat
and Dog
, but then I have to copy and paste the various state variables. It's a minor inconvenience, but I can't help but feeling like I'm missing something. Like I am thinking about this is a non-rusty way.
I know there is no direct inheritance (and I love the way traits are so powerful), but is there a way to avoid having to copy and paste all my properties alongside the traits?