mirror of https://github.com/go-redis/redis.git
13 lines
264 B
Go
13 lines
264 B
Go
|
package redis
|
||
|
|
||
|
import (
|
||
|
"reflect"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
func bytesToString(b []byte) string {
|
||
|
bytesHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b))
|
||
|
strHeader := reflect.StringHeader{bytesHeader.Data, bytesHeader.Len}
|
||
|
return *(*string)(unsafe.Pointer(&strHeader))
|
||
|
}
|