valit

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: 0

Documentation

Overview

Package valit allows for native Go values to be used with iterators.

Iterators:

  • Copies - yields copies of a given value forever.
  • Fill - yields the same value forever.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copies

func Copies[T Copier[T]](v T) itkit.Iterator[T]

Copies provides an iterator which yields copies of a given value on every iteration of the iterator.

func Fill

func Fill[T any](v T) itkit.Iterator[T]

Fill provides an iterator which yields the same value over and over again.

Types

type Copier

type Copier[T any] interface {
	Copy() T
}

Copier represents a struct that can copy itself.

type CopyIterator

type CopyIterator[T Copier[T]] struct {
	// contains filtered or unexported fields
}

CopyIterator represents an iterator yielding copies of a given value on every iteration of the iterator.

func (CopyIterator[T]) Next

func (it CopyIterator[T]) Next() bool

func (CopyIterator[T]) Value

func (it CopyIterator[T]) Value() T

type FillIterator

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

FillIterator represents an iterator yielding the same value over and over again.

func (FillIterator[T]) Next

func (it FillIterator[T]) Next() bool

func (FillIterator[T]) Value

func (it FillIterator[T]) Value() T

Jump to

Keyboard shortcuts

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