sliceit

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2022 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Overview

Package sliceit allows for native Go slices to be used with iterators.

Iterator functions:

  • To - convert a slice iterator to a native Go slice
  • In - provides an iterator from a native Go slice

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func In

func In[T any](s []T) itkit.Iterator[T]

In returns an [Iterator] yielding items in the given slice.

func To

func To[T any](it itkit.Iterator[T]) (out []T)

To consumes the [Iterator] returning its elements as a Go slice.

Types

type SliceIterator

type SliceIterator[T any] struct {
	Data []T
	// contains filtered or unexported fields
}

SliceIterator provides an iterator for slices that conforms to the Iterator protocol.

func (*SliceIterator[T]) Next

func (it *SliceIterator[T]) Next() (ok bool)

func (*SliceIterator[T]) Value

func (it *SliceIterator[T]) Value() T

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL