safe_map

package
v0.0.0-...-4f74120 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RWMap

type RWMap struct {
	sync.RWMutex // 读写锁保护下面的map字段
	// contains filtered or unexported fields
}

func NewRWMap

func NewRWMap(n int) *RWMap

NewRWMap 新建一个RWMap

func (*RWMap) Delete

func (m *RWMap) Delete(k int)

Delete 删除一个键

func (*RWMap) Each

func (m *RWMap) Each(f func(k, v int) bool)

Each 遍历map

func (*RWMap) Get

func (m *RWMap) Get(k int) (int, bool)

Get 从map中读取一个值

func (*RWMap) Len

func (m *RWMap) Len() int

Len map的长度

func (*RWMap) Set

func (m *RWMap) Set(k int, v int)

Set 设置一个键值对

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL