Skip to content

Commit

Permalink
add some documentation around functions
Browse files Browse the repository at this point in the history
  • Loading branch information
0x5a17ed committed May 29, 2024
1 parent 7bb00e7 commit eade8d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions itlib/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}
Expand Down
2 changes: 2 additions & 0 deletions itlib/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit eade8d7

Please sign in to comment.