traits.go 391 B

123456789101112131415161718192021
  1. package main
  2. // Determines validity of something
  3. type Valid interface {
  4. valid() bool
  5. }
  6. // Verifies validity of something
  7. func IsValid(v Valid) bool {
  8. return v.valid()
  9. }
  10. // Verifies invalidity of something
  11. func IsInvalid(v Valid) bool {
  12. return !v.valid()
  13. }
  14. // Attempt to merge all rendering code into one method (which could then be chained)
  15. type Render interface {
  16. render() string
  17. }