Maintainer trait for domain enumeration values #1530
HernanFAR
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
|
By the way, I'm not ignoring this, I have seen it, just not had time to take it in yet. Once I get the foldable changes complete (in the ref-folds branch), I'll take a closer look. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently I'm working with a project using domain driven design and I create some traits and prelude functions for DomainType, and I think that maybe worth to showcase them
As you will see, the Maintainer interface is a trait that must be associated with any "domain enumeration", like states of an entity or any limited set of values that represents something. These are the following definitions
Here is and example
And it can be used like this
What do you think? :)
Going forward
We can improve this trait by a source generator, it maybe posible to take the default values and create an "Match" instance method, following the example
So it can be used like this
Hi, @louthy! How' it going? I hope you're ok! I would like to create a PR with this trait, if you like the idea
Beta Was this translation helpful? Give feedback.
All reactions