package intern
import "internal/intern"
Package intern lets you make smaller comparable values by boxing a larger comparable value (such as a 16 byte string header) down into a globally unique 8 byte pointer.
The globally unique pointers are garbage collected with weak references and finalizers. This package hides that.
Index ¶
Types ¶
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
A Value pointer is the handle to an underlying comparable value. See func Get for how Value pointers may be used.
func Get ¶
Get returns a pointer representing the comparable value cmpVal.
The returned pointer will be the same for Get(v) and Get(v2) if and only if v == v2, and can be used as a map key.
func GetByString ¶
GetByString is identical to Get, except that it is specialized for strings. This avoids an allocation from putting a string into an interface{} to pass as an argument to Get.
func (*Value) Get ¶
Get returns the comparable value passed to the Get func that returned v.
Source Files ¶
- Version
- v1.19.11
- Published
- Jul 6, 2023
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 22 seconds ago –
Tools for package owners.