Documentation ¶
Index ¶
- func MapContains[T comparable, U any](m map[T]U, item T) bool
- func Max[T constraints.Ordered](a, b T) T
- func Min[T constraints.Ordered](a, b T) T
- func SliceContains[S ~[]T, T comparable](slice S, item T) bool
- func SliceToMap[S ~[]T, T comparable](slice S) map[T]bool
- func ToPtr[T any](x T) *T
- func ToVal[T any](ptr *T) (val T, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapContains ¶
func MapContains[T comparable, U any](m map[T]U, item T) bool
MapContains takes in a map and an item to check for as a key in that map. If the item is a key in the map, it returns true; otherwise it returns false.
func SliceContains ¶
func SliceContains[S ~[]T, T comparable](slice S, item T) bool
SliceContains takes in a slice and an item to check for in the slice. If the item is in the slice, it returns true, otherwise it returns false.
func SliceToMap ¶ added in v0.2.0
func SliceToMap[S ~[]T, T comparable](slice S) map[T]bool
SliceToMap takes in a slice and returns a map with the slice values as keys and each corresponding value set to true. If the slice contains duplicate values, the map will only contain one each duplicated value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.