order

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToMap

func ToMap[O cmp.Ordered, T any](pairs []*KVPair[O, T]) map[O]T

ToMap converts a slice of flattened pairs to a map.

Types

type KVPair

type KVPair[O cmp.Ordered, T any] struct {
	Key   O
	Value T
}

KVPair is a pair of key and value for a map. The key must be orderable.

func OrderMap

func OrderMap[O cmp.Ordered, T any](m map[O]T) []*KVPair[O, T]

OrderMap orders a map lexicographically by its keys. It permits any map with keys that are generically orderable.

Jump to

Keyboard shortcuts

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