Documentation
¶
Index ¶
- Constants
- func Get[T any]() *T
- func GetMap[K comparable, V any]() map[K]V
- func GetMapPtr[K comparable, V any]() uintptr
- func GetMapTypePool[K comparable, V any]() *sync.Pool
- func GetPtr[T any]() uintptr
- func GetPtrAndIndex[T any]() (uintptr, int)
- func GetPtrAny(a any) uintptr
- func GetPtrAnyAndIndex(a any) (uintptr, int)
- func GetSlice[T any](cap int) []T
- func GetSlice2[T any](s *SlicePool, cap int) []T
- func GetSliceForSize[T any](size int) []T
- func GetSliceForSize2[T any](sp *SlicePool, size int) []T
- func GetTypePool[T any]() *sync.Pool
- func Put[T any](t *T)
- func PutBytes(b Bytes)
- func PutMap[K comparable, V any](t map[K]V)
- func PutSlice[T any](t []T)
- func PutSliceClear[T any](t []T)
- type Bytes
- func (b *Bytes) Bytes() []byte
- func (b *Bytes) Cap() int
- func (b *Bytes) Len() int
- func (b *Bytes) Reset()
- func (b *Bytes) String() string
- func (b *Bytes) WriteBool(v bool)
- func (b *Bytes) WriteBytes(c ...byte)
- func (b *Bytes) WriteFloat(f float64)
- func (b *Bytes) WriteInt(i int64)
- func (b *Bytes) WriteString(s string)
- func (b *Bytes) WriteUint(i uint64)
- type Clear
- type MapType
- type PtrType
- type Slice
- type SlicePool
- type Type
Constants ¶
View Source
const (
KindMask = (1 << 5) - 1
)
Variables ¶
This section is empty.
Functions ¶
func GetMap ¶
func GetMap[K comparable, V any]() map[K]V
GetMap get a map from object pool with K and V
func GetMapPtr ¶
func GetMapPtr[K comparable, V any]() uintptr
GetMapPtr get type pointer of map[K]V
func GetMapTypePool ¶ added in v0.0.3
func GetMapTypePool[K comparable, V any]() *sync.Pool
GetMapTypePool get a sync.Pool with map[K]V
func GetPtrAndIndex ¶ added in v0.0.2
func GetPtrAnyAndIndex ¶ added in v0.0.2
func GetSliceForSize ¶
GetSliceForSize get a slice from object pool with T and size, len() == size
func GetSliceForSize2 ¶ added in v0.0.3
func PutMap ¶
func PutMap[K comparable, V any](t map[K]V)
PutMap put a map to object pool with K and V
func PutSliceClear ¶
func PutSliceClear[T any](t []T)
Types ¶
type Bytes ¶
type Bytes []byte
Bytes is a slice object pool for byte
func (*Bytes) WriteBytes ¶
func (*Bytes) WriteFloat ¶
func (*Bytes) WriteString ¶
type Clear ¶
type Clear interface {
Reset()
}
Clear is an interface that can be implemented by a struct to reset its value Just for the convenience of objectpool
type MapType ¶
type MapType struct { Type Key *Type Elem *Type Bucket *Type // internal type representing a hash bucket // function for hashing keys (ptr to key, seed) -> hash Hasher func(unsafe.Pointer, uintptr) uintptr KeySize uint8 // size of key slot ValueSize uint8 // size of elem slot BucketSize uint16 // size of bucket Flags uint32 }
MapType copy from abi.MapType
type SlicePool ¶ added in v0.0.3
type SlicePool struct {
// contains filtered or unexported fields
}
func GetSliceTypePool ¶ added in v0.0.3
GetSliceTypePool get a SlicePool with T
Click to show internal directories.
Click to hide internal directories.