aboutsummaryrefslogtreecommitdiffstats
path: root/internal/tag
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tag')
-rw-r--r--internal/tag/tag.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/tag/tag.go b/internal/tag/tag.go
new file mode 100644
index 0000000..197d2d6
--- /dev/null
+++ b/internal/tag/tag.go
@@ -0,0 +1,12 @@
+package tag
+
+type Tagged[V, T any] struct {
+ Val V
+ Tag T
+}
+
+func Tag[V, T any](out chan<- Tagged[V, T], in <-chan V, f func(V) T) {
+ for val := range in {
+ out <- Tagged[V, T]{val, f(val)}
+ }
+}