notsafe

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package notsafe provides unsafe helper functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArrayElem

func GetArrayElem[T any](array unsafe.Pointer, index int, elemSize uintptr) T

GetArrayElem returns an element by index from the array referenced by an unsafe pointer

func GetArrayElemRef

func GetArrayElemRef(array unsafe.Pointer, index int, elemSize uintptr) unsafe.Pointer

GetArrayElemRef returns an element's pointer by index from the array referenced by an unsafe pointer

func GetArrayPointer

func GetArrayPointer[T any](elements []T) unsafe.Pointer

GetArrayPointer retrieves the pointer of a slice underlying array

func GetLen

func GetLen[T any](elements []T) int

GetLen returns the length of elements

func GetSliceHeader

func GetSliceHeader[T any](elements []T) *reflect.SliceHeader

GetSliceHeader retrieves the SliceHeader of elements

func GetSliceHeaderByRef

func GetSliceHeaderByRef(elements unsafe.Pointer) *reflect.SliceHeader

GetSliceHeaderByRef retrieves the SliceHeader of elements by an unsafe pointer

func GetTypeSize

func GetTypeSize[T any]() uintptr

GetTypeSize retrieves size of a type T

func InHeap

func InHeap[T any](t *T) bool

InHeap is generic link to runtime.inheap

func Noescape

func Noescape[T any](t *T) *T

Noescape prevent escaping of t

Types

This section is empty.

Jump to

Keyboard shortcuts

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