package xunsafe

import "git.sr.ht/~jamesponddotco/xstd-go/xunsafe"

Package xunsafe provides utilities for unsafe operations.

Index

Functions

func BytesToString

func BytesToString(slice []byte) string

BytesToString converts a byte slice to a string without memory allocation.

The byte slice must not be used, modified, or reallocated after this call since the returned string references the same memory.

func StringToBytes

func StringToBytes(str string) []byte

StringToBytes converts a string to a byte slice without memory allocation.

The string must not be used, modified, or reallocated after this call since the returned byte slice references the same memory.

Source Files

conversion.go xunsafe.go

Version
v0.13.1 (latest)
Published
Jan 29, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
4 days ago

Tools for package owners.