You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enum is a one way to address the delegation (to commands).
I think enums should be added too. I might add it too a bit later. However, there is also a simple trade off between dyn traits and enums. If delegation occurs externally (crates for example), then trait objects would suit better, since we don't know in advance what kind of type a user may come up with. Like in actix. But if we are going to use it in our own application then since we control the enum variants and if add new variants not too frequently, we could use enum.
Note that actix-web uses HashMap<Any, ...> for data extractor which trades off type safety (it will error out on runtime rather than compile time for the wrong type) for ergonomic, if we want to do something like this that allows users to use any type but with Any type (not sure if there are any other methods) we would want to state the downsides beforehand.
Enum is a one way to address the delegation (to commands).
I think enums should be added too. I might add it too a bit later. However, there is also a simple trade off between dyn traits and enums. If delegation occurs externally (crates for example), then trait objects would suit better, since we don't know in advance what kind of type a user may come up with. Like in actix. But if we are going to use it in our own application then since we control the enum variants and if add new variants not too frequently, we could use enum.
Originally posted by @fade2black in #247 (comment)
The text was updated successfully, but these errors were encountered: