generic

package
v0.0.0-...-e5a9e99 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InverseInPlace

func InverseInPlace[T any](inp []T) []T

func MergeSlices

func MergeSlices[T comparable](s1 []T, s2 []T) []T

func Permutations

func Permutations[T any](arr []T) [][]T

func RemoveFirstFromSliceInPlace

func RemoveFirstFromSliceInPlace[T comparable](inp []T, elem T) []T

func Trim

func Trim[T comparable](inp []T, cut T) []T

func Truncate

func Truncate[T any](inp []T) []T

Types

type FixedSizePool

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

FixedSizePool is offensive concurrent-safe pool with preallocated count of elements it throws exceptions in case of:

  • element leakage (if buffer is drained)
  • trying to use more elements that were allocated (if buffer is drained)
  • double frees (if buffer is overflowed)

func NewFixedSizePool

func NewFixedSizePool[T any](new func() T, maxSize int) FixedSizePool[T]

func (*FixedSizePool[T]) Get

func (f *FixedSizePool[T]) Get() T

func (*FixedSizePool[T]) GetWrapped

func (f *FixedSizePool[T]) GetWrapped() FixedSizePoolElementWrapped[T]

func (*FixedSizePool[T]) Release

func (f *FixedSizePool[T]) Release(elem T)

type FixedSizePoolElementWrapped

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

func (FixedSizePoolElementWrapped[T]) Release

func (e FixedSizePoolElementWrapped[T]) Release()

func (FixedSizePoolElementWrapped[T]) Unwrap

func (e FixedSizePoolElementWrapped[T]) Unwrap() T

type PermutationIterator

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

func NewPermutationIterator

func NewPermutationIterator[T any](firstPermutation []T) PermutationIterator[T]

func (*PermutationIterator[T]) Next

func (iter *PermutationIterator[T]) Next() []T

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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