uniquemap

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: MIT Imports: 3 Imported by: 0

README

uniquemap

The uniquemap package provides facilities for canonicalizing ("interning") maps with comparable keys and values.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

type Handle[Map ~map[K]V, K, V comparable] struct {
	// contains filtered or unexported fields
}

Handle is a globally unique identity for some map[K]V.

Two handles compare equal exactly if the two values used to create the handles would have also compared equal. The comparison of two handles is trivial and typically much more efficient than comparing the values used to create them.

func Make

func Make[Map ~map[K]V, K, V comparable](m Map) Handle[Map, K, V]

Make returns a globally unique handle for a map[K]V. Handles are equal if and only if the values used to produce them are equal. Make is safe for concurrent use by multiple goroutines.

func (Handle[Map, K, V]) Value

func (h Handle[Map, K, V]) Value() Map

Value returns a map of shallow copies of the key-value pairs that produced the Handle. Value is safe for concurrent use by multiple goroutines.

Jump to

Keyboard shortcuts

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