parser

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompFunc

type CompFunc[K any] func(K, K) bool

type OrderedMap

type OrderedMap[K, V any] struct {
	// contains filtered or unexported fields
}

a map that keeps it's keys sorted in ascending order

func New

func New[K, V any](eq, less CompFunc[K], capacity int) *OrderedMap[K, V]

create a new OrderedMap with the given equality and less functions

func (*OrderedMap[K, V]) Delete

func (m *OrderedMap[K, V]) Delete(key K)

delete the given key from the map

func (*OrderedMap[K, V]) Get

func (m *OrderedMap[K, V]) Get(key K) (V, bool)

returns the value for the given key and wether it exists

func (*OrderedMap[K, V]) IterateKeys

func (m *OrderedMap[K, V]) IterateKeys(f func(K) bool)

iterate over all Keys in the map until f returns false

func (*OrderedMap[K, V]) IterateValues

func (m *OrderedMap[K, V]) IterateValues(f func(V) bool)

iterate over all Values in the map until f returns false

func (*OrderedMap[K, V]) Keys

func (m *OrderedMap[K, V]) Keys() []K

collects all the keys in the map

func (*OrderedMap[K, V]) Set

func (m *OrderedMap[K, V]) Set(key K, value V)

set or insert a key value pair into the map

func (*OrderedMap[K, V]) Values

func (m *OrderedMap[K, V]) Values() []V

collects all the values in the map

Jump to

Keyboard shortcuts

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