zstdzgo.at/zstd/zmap Index | Files

package zmap

import "zgo.at/zstd/zmap"

Package zmap implements generic functions for maps.

Index

Functions

func KeyValue

func KeyValue[M ~map[K]V, K comparable, V any](m M) []struct {
	K K
	V V
}

KeyValue returns a struct slice with the keys and values.

func KeysOrdered

func KeysOrdered[M ~map[K]V, K ordered, V any](m M) []K

KeysOrdered returns the sorted keys of the map.

func LongestKey

func LongestKey[M ~map[string]V, V any](m M) ([]string, int)

LongestKey returns the longest key in this map and the unsorted list of all keys.

func Values

func Values[M ~map[K]V, K comparable, V any](m M) []V

Values returns the values of the map.

Source Files

zmap.go

Version
v0.0.0-20240930202209-a63c3335042a (latest)
Published
Sep 30, 2024
Platform
linux/amd64
Imports
1 packages
Last checked
2 days ago

Tools for package owners.