Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Unique ¶
type Unique[K comparable, V number.Number] struct { // contains filtered or unexported fields }
Unique generates numerical IDs in constant time within a given capacity. Note that we use a normal sync.Mutex for synchronization instead of a sync.RWMutex, because the synchronized code is many times faster than the additional overhead incurred by sync.RWMutex.
func (*Unique[K, V]) Length ¶
func (u *Unique[K, V]) Length() V
Length provides the amount of currently allocated IDs. Since ID allocation is strictly sequential, all IDs can be iterated in an idomatic range loop. The iterated order does not reflect the order of creation nor deletion.
for x := range u.Length() {
...
}
Click to show internal directories.
Click to hide internal directories.