代码拉取完成,页面将自动刷新
package common
// EntityIDSet is the data structure for a set of entity IDs
type EntityIDSet map[EntityID]struct{}
// Add adds an entity ID to EntityIDSet
func (es EntityIDSet) Add(id EntityID) {
es[id] = struct{}{}
}
// Del removes an entity ID from EntityIDSet
func (es EntityIDSet) Del(id EntityID) {
delete(es, id)
}
// Contains checks if entity ID is in EntityIDSet
func (es EntityIDSet) Contains(id EntityID) bool {
_, ok := es[id]
return ok
}
// ToList convert EntityIDSet to a slice of entity IDs
func (es EntityIDSet) ToList() []EntityID {
list := make([]EntityID, 0, len(es))
for eid := range es {
list = append(list, eid)
}
return list
}
func (es EntityIDSet) ForEach(cb func(eid EntityID) bool) {
for eid := range es {
if !cb(eid) {
break
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。