hack

package
v2.1.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2017 License: BSD-3-Clause Imports: 2 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 String

func String(b []byte) (s string)

String force casts a []byte to a string. USE AT YOUR OWN RISK

func StringPointer

func StringPointer(s string) unsafe.Pointer

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL