From eade8d78b05281828c956461e33ba17a7f15db52 Mon Sep 17 00:00:00 2001 From: x5a17ed <0x5a17ed@tuta.io> Date: Wed, 29 May 2024 18:01:30 +0200 Subject: [PATCH] add some documentation around functions --- itlib/chain.go | 2 ++ itlib/filter.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/itlib/chain.go b/itlib/chain.go index 3160a99..ae1842a 100644 --- a/itlib/chain.go +++ b/itlib/chain.go @@ -31,6 +31,7 @@ type ChainIterator[T any] struct { // Ensure ChainIterator conforms to the Iterator protocol. var _ itkit.Iterator[struct{}] = &ChainIterator[struct{}]{} +// Next implements the [itkit.Iterator.Next] interface. func (c *ChainIterator[T]) Next() bool { if c.current != nil && c.current.Next() { return true @@ -44,6 +45,7 @@ func (c *ChainIterator[T]) Next() bool { return false } +// Value implements the [itkit.Iterator.Value] interface. func (c *ChainIterator[T]) Value() T { return c.current.Value() } diff --git a/itlib/filter.go b/itlib/filter.go index 8e11446..57f4608 100644 --- a/itlib/filter.go +++ b/itlib/filter.go @@ -26,6 +26,7 @@ type FilterIter[T any] struct { cur T } +// Next implements the [itkit.Iterator.Next] interface. func (f *FilterIter[T]) Next() bool { var next T for f.it.Next() { @@ -37,6 +38,7 @@ func (f *FilterIter[T]) Next() bool { return false } +// Value implements the [itkit.Iterator.Value] interface. func (f *FilterIter[T]) Value() T { return f.cur } // Filter returns an Iterator yielding items from the given iterator