unsafex

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(bytes []byte) string

BytesToString unsafe convert byte array content to string This function do not allocate new buffer, reuse the bytes data.

func CurrentGoroutineId added in v1.2.0

func CurrentGoroutineId() int64

CurrentGoroutineId get current goroutine id by walk stack. This func get goroutine id by parse current stack string, the performance is not so good.

func InterfaceIsNil added in v1.6.0

func InterfaceIsNil(iface interface{}) bool

InterfaceIsNil return true if interface is nil or it's value is a nil pointer

func InterfaceValuePtr added in v1.6.0

func InterfaceValuePtr(iface interface{}) unsafe.Pointer

InterfaceValuePtr return the value pointer of interface

func StringToBytes

func StringToBytes(str string) []byte

StringToBytes unsafe convert string to byte array This function do not allocate new buffer, reuse the string buffer.

Types

type SliceHeader added in v1.7.1

type SliceHeader struct {
	Data unsafe.Pointer
	Len  int
	Cap  int
}

SliceHeader copy from reflect.SliceHeader, using Data type unsafe.Pointer instead of unitptr, to prevent stack allocation, or free by gc

type StringHeader added in v1.7.1

type StringHeader struct {
	Data unsafe.Pointer
	Len  int
}

StringHeader copy from reflect.StringHeader, using Data type unsafe.Pointer instead of unitptr, to prevent stack allocation, or free by gc

Jump to

Keyboard shortcuts

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