umgefahren / tysyncmap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tysyncmap

Go Reference

Typed version of sync.Map using Go 1.18 generics.

Examples

package main

import (
	"fmt"
	"tysyncmap"
)

func main() {
	m := new(tysyncmap.Map[string, string])
	m.Store("key", "value")
	val, ok := m.Load("key")
	if !ok {
		panic("should have been loaded")
	}
	fmt.Println(val)
}

Output:

value

About

License:The Unlicense


Languages

Language:Go 100.0%