iter.go 435 B

1234567891011121314151617181920
  1. package iters
  2. // Implementing the interface lets us iterate through the
  3. // the data by lightweight channels.
  4. type Channeler[V any] interface {
  5. Chan() chan V
  6. }
  7. // Implementing the interface provides the way to
  8. // convert the type to slice.
  9. type Slicer[V any] interface {
  10. Slice() []V
  11. }
  12. // Implementing the interface provides us the way to
  13. // convert the type to map.
  14. type Mapper[K comparable, V any] interface {
  15. Map() map[K] V
  16. }