Documentation ¶
Overview ¶
Package hack gives you some efficient functionality at the cost of breaking some Go rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringPointer ¶
StringPointer returns &s[0], which is not allowed in go
Types ¶
type StringArena ¶
type StringArena struct {
// contains filtered or unexported fields
}
StringArena lets you consolidate allocations for a group of strings that have similar life length
func NewStringArena ¶
func NewStringArena(size int) *StringArena
NewStringArena creates an arena of the specified size.
func (*StringArena) NewString ¶
func (sa *StringArena) NewString(b []byte) string
NewString copies a byte slice into the arena and returns it as a string. If the arena is full, it returns a traditional go string.
func (*StringArena) SpaceLeft ¶
func (sa *StringArena) SpaceLeft() int
SpaceLeft returns the amount of space left in the arena.
Click to show internal directories.
Click to hide internal directories.