Documentation ¶
Index ¶
- func AppendUnique[S ~[]E, E comparable](in S, add ...E) S
- func AppendUniqueFunc[S ~[]E, E comparable](in S, cmp func(E, E) int, add ...E) S
- func AsAny[S ~[]T, T any](s S) []any
- func Convert[T, S any](a []S) []T
- func ConvertPointer[T any, S ~[]P, E any, P generics.PointerType[E]](s S) []T
- func ConvertWith[S, T, I any](in []S, c func(I) T) []T
- func CopyAppend[E any](slice []E, elems ...E) []E
- func CopyAppendUnique[S ~[]E, E comparable](in S, add ...E) S
- func CopyAppendUniqueFunc[S ~[]E, E any](in S, eq func(E, E) bool, add ...E) S
- func Filter[S ~[]E, E any](in S, f matcher.Matcher[E]) S
- func Transform[S ~[]E, E any, T any](in S, m func(E) T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendUnique ¶
func AppendUnique[S ~[]E, E comparable](in S, add ...E) S
AppendUnique appends elements to a slice, if they are not net contained.
func AppendUniqueFunc ¶
func AppendUniqueFunc[S ~[]E, E comparable](in S, cmp func(E, E) int, add ...E) S
AppendUniqueFunc returns appends additional elements, if they are considered by the given function not to be yet present.
func Convert ¶
func Convert[T, S any](a []S) []T
Convert converts a slice to a slice with a more general element type.
func ConvertPointer ¶
func ConvertPointer[T any, S ~[]P, E any, P generics.PointerType[E]](s S) []T
ConvertPointer converts a slice of pointers to an interface slice avoiding typed nil interfaces.
func ConvertWith ¶
func ConvertWith[S, T, I any](in []S, c func(I) T) []T
ConvertWith converts the element type of a slice using a converter function. Unfortunately this cannot be expressed in a type-safe way in Go. I MUST follow the type constraint I super S, which cannot be expressed in Go. If I == S the Transform function should be used, instead.
func CopyAppend ¶
func CopyAppend[E any](slice []E, elems ...E) []E
CopyAppend returns a new slice containing the additional elements appended to to the original slice.
func CopyAppendUnique ¶
func CopyAppendUnique[S ~[]E, E comparable](in S, add ...E) S
CopyAppendUnique returns a new slice with additional elements appended, if they are not net contained.
func CopyAppendUniqueFunc ¶
CopyAppendUniqueFunc returns a new slice with additional elements appended, if they are considered by the given function not to be yet present.
Types ¶
This section is empty.