defs

package
v0.0.0-...-d9bdf42 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Unlicense Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](s []T, n int) (T, error)

Get returns the nth element of slice s. Returns error if slice s does not have an element at index n.

For most access attempts on strings, []rune(str) will be a more appropriate choice than []byte(str) for the parameter s, as no individual byte in []byte(str) is guaranteed to hold a single Unicode code point.

func Has

func Has[T comparable](s []T, elem T) bool

Contains checks slice s for the existence of an element elem.

func HasOnly

func HasOnly[T comparable](s []T, elem T) bool

HasOnly checks if all elements of s are elem.

func Remove

func Remove[T comparable](s []T, elem T) []T

Remove attempts to remove element elem from slice s and return the resulting slice. If elem is not present in s, s is returned unchanged.

Types

This section is empty.

Jump to

Keyboard shortcuts

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