Skip to content

Conversation

@sterraf
Copy link
Contributor

@sterraf sterraf commented Apr 14, 2025

WIP on defining a BusinessInvariants trait. For the particular case of NonEmptySet, it checks that the inner Vec is nonempty and contains no repetitions. For the last check, I'm using BTreeSet as a proxy, but this can be obviously changed to HashSet.

The trait provides the Boolean validate_data method; another option would be to return a Result<(), E> where E describes more precisely the problems encountered.

@sterraf sterraf changed the title feat: business invariants for Non empty set newtype feat: business invariants for NonEmptySet Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant