Replies: 1 comment 1 reply
-
That pattern is used to store different types in a collection, without using trait objects and dynamic dispatch. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I've got a little suggestion here for the
Shape
enum.In my opinion each shape should be a struct and not an enum-entry. Reason: Each
enum has its own functions. If we take a look into the methods of the enum, we
can clearly see, that each enum entry has the "same" functions but with a
different implementation => This can be done with a trait!
What do you think? @flxzt
Edit 1
Wait a minute, I just see, that the Shapes are already implemented as a struct. So the enum is just for easier matching?
Beta Was this translation helpful? Give feedback.
All reactions