distribution/vendor/github.com/redis/go-redis/v9/internal/util/unsafe.go
Milos Gajdos 52f0f6c45d
Bump Azure deps
This pulls in go-redis update as well.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2025-03-27 22:44:26 -07:00

23 lines
363 B
Go

//go:build !appengine
package util
import (
"unsafe"
)
// BytesToString converts byte slice to string.
func BytesToString(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
// StringToBytes converts string to byte slice.
func StringToBytes(s string) []byte {
return *(*[]byte)(unsafe.Pointer(
&struct {
string
Cap int
}{s, len(s)},
))
}