Documentation
¶
Index ¶
- func FilterFunc[S ~[]E, E any](s S, fn func(E) bool) (outs []E)
- func FilterMapFunc[S ~[]E, E any](s S, fn func(E) (E, bool)) (outs []E)
- func First[S ~[]E, E any](s S) (out E)
- func FirstFunc[S ~[]E, E any](s S, fn func(E) bool) (out E)
- func FirstN[S ~[]E, E any](s S, n int) (out []E)
- func Get[S ~[]E, E any](s S, n int) (out E)
- func GetOr[S ~[]E, E any](s S, n int, fallback E) (out E)
- func GetOrFunc[S ~[]E, E any](s S, n int, fallback func() E) (out E)
- func GetX[S ~[]E, E any](s S, n int) (out E, ok bool)
- func Last[S ~[]E, E any](s S) (out E)
- func LastFunc[S ~[]E, E any](s S, fn func(E) bool) (out E)
- func LastN[S ~[]E, E any](s S, n int) (out []E)
- func MapFilterFunc[S ~[]E, E, R any](s S, fn func(E) (R, bool)) (outs []R)
- func MapFunc[S ~[]E, E, R any](s S, fn func(E) R) []R
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterFunc ¶
FilterFunc returns a new slice with elements that satisfy the function.
func FilterMapFunc ¶ added in v0.1.0
FilterMapFunc (or FilterMapFunc) returns a new slice with elements that satisfy the function, and maps them to a new type.
func Get ¶ added in v0.1.0
Get returns the element at index n. If n is negative, it returns from the end.
func GetOr ¶ added in v0.1.0
GetOr returns the element at index n. If n is negative, it returns from the end. If n is out of range, it returns the fallback value.
func GetOrFunc ¶ added in v0.1.0
GetOrFunc returns the element at index n. If n is negative, it returns from the end. If n is out of range, it returns the result of the fallback function.
func GetX ¶ added in v0.1.0
GetX returns the element at index n. If n is negative, it returns from the end.
func MapFilterFunc ¶
MapFilterFunc (or FilterMapFunc) returns a new slice with elements that satisfy the function, and maps them to a new type.
Types ¶
This section is empty.