unsafes

package
v0.0.0-...-388587c Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package unsafes provides the low-level unsafe functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteSlice

func ByteSlice(s string) []byte

ByteSlice converts a strings into the equivalent byte slice without doing the actual copy of the data. The slice returned by this function may be read-only. See examples for more details.

func NoEscape

func NoEscape(p unsafe.Pointer) unsafe.Pointer

NoEscape hides a pointer from escape analysis.

func String

func String(b []byte) string

String transforms a slice of byte into a string without doing the actual copy of the data.

Types

type SliceHeader

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

SliceHeader is the same as reflect.SliceHeader but with unsafe.Pointers to guarantee they don't get collected by the GC.

type StringHeader

type StringHeader struct {
	Data unsafe.Pointer
	Len  int
}

StringHeader is the same as reflect.StringHeader but with unsafe.Pointers to guarantee they don't get collected by the GC.

Jump to

Keyboard shortcuts

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