| 1 | //go:build go1.24 |
| 2 | // +build go1.24 |
| 3 | |
| 4 | package hasherscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/ |
| 5 | |
| 6 | import ( |
| 7 | "hash/maphashscip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/" |
| 8 | ) |
| 9 | |
| 10 | type Hasherscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#[K comparable] struct { |
| 11 | seedscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#seed. maphashscip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/.Seedscip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/Seed# |
| 12 | kfuncscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#kfunc. func(K) string |
| 13 | } |
| 14 | |
| 15 | func NewHasherscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/NewHasher().[K comparable](stringKeyFunc func(K) string) *Hasherscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#[K] { |
| 16 | // TODO: stringKeyFunc was used prior to Go 1.24 when Comparable was unavailable. |
| 17 | // With the introduction of Comparable, special handling for struct with string field key is no longer necessary. |
| 18 | return &Hasherscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#[K]{kfuncscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#kfunc.: stringKeyFunc, seedscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#seed.: maphashscip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/.MakeSeedscip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/MakeSeed().()} |
| 19 | } |
| 20 | |
| 21 | func (h *Hasherscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#[K]) Hashscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#Hash().(key K) uint64 { |
| 22 | if h.kfuncscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#kfunc. != nil { |
| 23 | return maphashscip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/.Comparablescip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/Comparable().(h.seedscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#seed., h.kfuncscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#kfunc.(key)) |
| 24 | } |
| 25 | return maphashscip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/.Comparablescip-go gomod github.com/golang/go/src go1.20 `hash/maphash`/Comparable().(h.seedscip-go gomod github.com/Yiling-J/theine-go . `github.com/Yiling-J/theine-go/internal/hasher`/Hasher#seed., key) |
| 26 | } |