goutils

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keys

func Keys[K comparable, T any](m map[K]T) []K

func Pop

func Pop[T any](s []T) (T, []T)

func PtrTo

func PtrTo[T any](t T) *T

func RemoveElement added in v0.1.2

func RemoveElement[K comparable](s []K, k K) []K

Types

type Current

type Current[T any] func() T

type Iterator

type Iterator[T any] struct {
	Seq iter.Seq[T]
	Current[T]
	Next[T]
}

func NewIterator

func NewIterator[T any](tt []T) Iterator[T]

type Next

type Next[T any] func() (T, bool)

type Set

type Set[K comparable] map[K]struct{}

func (Set[K]) Add added in v0.1.2

func (s Set[K]) Add(k K)

Add adds a key k to the set

func (Set[K]) Copy

func (s Set[K]) Copy() Set[K]

Copy returns a shallow copy of the set

func (Set[K]) Difference

func (s Set[K]) Difference(others ...Set[K]) Set[K]

Difference returns a new set containing values that are not in others

func (Set[K]) Intersection

func (s Set[K]) Intersection(others ...Set[K]) Set[K]

Intersection returns a new set containing values that are in both the set and all others

func (Set[K]) SymmetricDifference

func (s Set[K]) SymmetricDifference(other Set[K]) Set[K]

SymmetricDifference returns a new set containing values that are in the original set or other but not both

func (Set[K]) Union

func (s Set[K]) Union(others ...Set[K]) Set[K]

Union returns a new set containing all values in the set and others

func (Set[K]) Update

func (s Set[K]) Update(others ...Set[K]) Set[K]

Update returns the set with all keys from others added

Jump to

Keyboard shortcuts

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