github.com/searKing/golang/go@v1.2.74/util/spliterator/seenmap_syncmap.go (about) 1 // Code generated by "go-syncmap -type seenMap<interface{}, struct{}>"; DO NOT EDIT. 2 3 package spliterator 4 5 import "sync" 6 7 func _() { 8 // An "cannot convert seenMap literal (type seenMap) to type sync.Map" compiler error signifies that the base type have changed. 9 // Re-run the go-syncmap command to generate them again. 10 _ = (sync.Map)(seenMap{}) 11 } 12 13 var _nil_seenMap_struct___value = func() (val struct{}) { return }() 14 15 func (m *seenMap) Store(key interface{}, value struct{}) { 16 (*sync.Map)(m).Store(key, value) 17 } 18 19 func (m *seenMap) LoadOrStore(key interface{}, value struct{}) (struct{}, bool) { 20 actual, loaded := (*sync.Map)(m).LoadOrStore(key, value) 21 if actual == nil { 22 return _nil_seenMap_struct___value, loaded 23 } 24 return actual.(struct{}), loaded 25 } 26 27 func (m *seenMap) Load(key interface{}) (struct{}, bool) { 28 value, ok := (*sync.Map)(m).Load(key) 29 if value == nil { 30 return _nil_seenMap_struct___value, ok 31 } 32 return value.(struct{}), ok 33 } 34 35 func (m *seenMap) Delete(key interface{}) { 36 (*sync.Map)(m).Delete(key) 37 } 38 39 func (m *seenMap) Range(f func(key interface{}, value struct{}) bool) { 40 (*sync.Map)(m).Range(func(key, value interface{}) bool { 41 return f(key.(interface{}), value.(struct{})) 42 }) 43 }