blob: 4bc79701f4956b54d640e0f0a494cdafeeea2680 [file] [log] [blame]
serkant.uluderyae5afeff2021-02-23 18:00:23 +03001// +build !appengine
2
3package internal
4
5import "unsafe"
6
7// String converts byte slice to string.
8func String(b []byte) string {
9 return *(*string)(unsafe.Pointer(&b))
10}
11
12// Bytes converts string to byte slice.
13func Bytes(s string) []byte {
14 return *(*[]byte)(unsafe.Pointer(
15 &struct {
16 string
17 Cap int
18 }{s, len(s)},
19 ))
20}