matcher.go 428 B

1234567891011121314151617
  1. package matcher
  2. // Matcher represents anything that can be used to match against given generic type T.
  3. type Matcher[T any] interface {
  4. String() string
  5. // Matches is the canonical in-Go function for determining if T
  6. // matches a specific implementation's rules.
  7. Matches(T) bool
  8. }
  9. // MatcherGroup is useful for dynamically creating group based matchers.
  10. type MatcherGroup[T any] interface {
  11. Matcher[T]
  12. Add(Matcher[T])
  13. }