Skip to content

Add example for static dispatch with enums to Command pattern #252

Open
@simonsan

Description

@simonsan

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-patternArea: Content about PatternsC-enhancementCategory: Enhancements to content

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions