Improve platform status

This commit is contained in:
世界 committed 2023-07-16 14:08:45 +08:00
1 parent 1a29c23263
commit 6e6998dab7
4 files changed
+45 -6

No files matched your search

+9
View File
@@ -7,6 +7,15 @@ type Map[K comparable, V any] struct {
m sync.Map
}
func (m *Map[K, V]) Len() int {
var count int
m.m.Range(func(key, value any) bool {
count++
return true
})
return count
}
func (m *Map[K, V]) Load(key K) (V, bool) {
v, ok := m.m.Load(key)
if !ok {