9 lines
187 B
Go
Raw Normal View History

2021-01-01 15:28:28 +05:30
package tostring
import "unsafe"
// UnsafeToString converts byte slice to string with zero allocations
func UnsafeToString(bs []byte) string {
return *(*string)(unsafe.Pointer(&bs))
}