Change to TypedSyncMap

This commit is contained in:
风扇滑翔翼 2025-07-26 12:05:21 +00:00 committed by GitHub
parent b6b51c51c8
commit 20825f6f1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 29 additions and 31 deletions

View file

@ -15,8 +15,8 @@ type TypedSyncMap[K, V any] struct {
// K is key type, V is value type
// It is recommended to use pointer types for V because sync.Map might return nil
// If sync.Map methods really returned nil, it will return the zero value of the type V
func NewTypedSyncMap[K any, V any]() *TypedSyncMap[K, V] {
return &TypedSyncMap[K, V]{
func NewTypedSyncMap[K any, V any]() TypedSyncMap[K, V] {
return TypedSyncMap[K, V]{
syncMap: &sync.Map{},
}
}