hashmap

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package hashmap implements a generic wrapper around a built in map type which allows interface types like PublicKeyHash to be used as map keys

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashMap

type HashMap[H tz.Comparable[K], K tz.ToComparable[H, K], V any] map[H]V

HashMap is a wrapper around a built in map type which allows interface types like gotez.PublicKeyHash to be used as map keys

func New

func New[H tz.Comparable[K], K tz.ToComparable[H, K], V any](init []KV[K, V]) HashMap[H, K, V]

func (HashMap[H, K, V]) ForEach

func (m HashMap[H, K, V]) ForEach(cb func(key K, val V) bool) bool

func (HashMap[H, K, V]) Get

func (m HashMap[H, K, V]) Get(key K) (V, bool)

func (HashMap[H, K, V]) Insert

func (m HashMap[H, K, V]) Insert(key K, val V) (V, bool)

type KV

type KV[K, V any] struct {
	Key K
	Val V
}

type PublicKeyHashMap

type PublicKeyHashMap[V any] HashMap[tz.EncodedPublicKeyHash, tz.PublicKeyHash, V]

PublicKeyHashMap is a shortcut for a map with gotez.PublicKeyHash keys

func NewPublicKeyHashMap

func NewPublicKeyHashMap[V any](init []PublicKeyKV[V]) PublicKeyHashMap[V]

func (PublicKeyHashMap[V]) ForEach

func (m PublicKeyHashMap[V]) ForEach(cb func(key tz.PublicKeyHash, val V) bool) bool

func (PublicKeyHashMap[V]) Get

func (m PublicKeyHashMap[V]) Get(key tz.PublicKeyHash) (V, bool)

func (PublicKeyHashMap[V]) Insert

func (m PublicKeyHashMap[V]) Insert(key tz.PublicKeyHash, val V) (V, bool)

type PublicKeyKV

type PublicKeyKV[V any] KV[tz.PublicKeyHash, V]

Jump to

Keyboard shortcuts

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