mirror of
https://github.com/golang/go
synced 2024-11-25 10:17:57 -07:00
24 lines
321 B
Go
24 lines
321 B
Go
|
package lib
|
||
|
|
||
|
type FMap[K comparable, V comparable] map[K]V
|
||
|
|
||
|
//go:noinline
|
||
|
func (m FMap[K, V]) Flip() FMap[V, K] {
|
||
|
out := make(FMap[V, K])
|
||
|
return out
|
||
|
}
|
||
|
|
||
|
type MyType uint8
|
||
|
|
||
|
const (
|
||
|
FIRST MyType = 0
|
||
|
)
|
||
|
|
||
|
var typeStrs = FMap[MyType, string]{
|
||
|
FIRST: "FIRST",
|
||
|
}
|
||
|
|
||
|
func (self MyType) String() string {
|
||
|
return typeStrs[self]
|
||
|
}
|