xiter

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: MIT Imports: 0 Imported by: 0

README

xiter

A Generic Library for Go with the Power of Iterators

codecov ci.yml

Introduction

TL;DR: The Go team ultimately did not implement the iterator utility due to various considerations, which led to the creation of this package.


About two years ago, rsc (Russ Cox) proposed x/exp/xiter: new package with iterator adapters, which defined a new package but was ultimately declined.

This was not the first attempt by the Go community to address iterator patterns:

These proposals introduced new approaches for native iterator implementation in Go, but were eventually rejected.

The reason can be summarized as below:

  • Overabstraction: Many participants felt that the proposed iterator adapters encouraged overabstraction, which could lead to code that is harder to read and maintain.
  • Lack of Clear Use Cases: There was a general sentiment that the proposed functions did not have clear, compelling use cases that justified their inclusion in the standard library.

The Go team recommended this functionality be implemented through third-party packages, which is why this project exists.

Target

This package is designed to implement iterator utilities which are defined in proposal: x/exp/xiter: new package with iterator adapters.

And this package will also provide some generic utilities with iter.

This package considers Go versions before 1.23, starting from Go 1.18+

Docs

Full Docs

Docs For Packages:

Contribution

  • Make an issue to tell us what you want.
  • Create pull request and link to issue.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
cmp
internal/constraints
Package constraints defined constraints for generics tools
Package constraints defined constraints for generics tools
optional
Package optional provides a type which can be used to represent a value that may or may not be present like option in Rust.
Package optional provides a type which can be used to represent a value that may or may not be present like option in Rust.
xiter
Package xiter provides the abstraction of map, slice or channel types into iterators for common processing In most scenarios, we DO NOT need to use the xiter package directly
Package xiter provides the abstraction of map, slice or channel types into iterators for common processing In most scenarios, we DO NOT need to use the xiter package directly
xstl/list
Package list implements a doubly linked list.
Package list implements a doubly linked list.
xsync
package xsync provides some generics wrappers for some standard libraries like sync.Map, sync.Pool, sync.Mutext etc.
package xsync provides some generics wrappers for some standard libraries like sync.Map, sync.Pool, sync.Mutext etc.

Jump to

Keyboard shortcuts

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