summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go
blob: 23accd40e048e9241c5e9be5f49d6f90790c8b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// +build !appengine

package bunotel

import "unsafe"

func bytesToString(b []byte) string {
	return *(*string)(unsafe.Pointer(&b))
}

func stringToBytes(s string) []byte {
	return *(*[]byte)(unsafe.Pointer(
		&struct {
			string
			Cap int
		}{s, len(s)},
	))
}