// NewByteRef creates an unsafe byte slice reference to the given string.
// The referenced data is not guaranteed to stay valid if no reference to the
// original string is held anymore. The returned ByteRef does not count as
// reference.
// Writing to the returned ByteRef will result in a segfault.
NewByteRef creates an unsafe byte slice reference to the given string.
The referenced data is not guaranteed to stay valid if no reference to the
original string is held anymore. The returned ByteRef does not count as
reference.
Writing to the returned ByteRef will result in a segfault.
// NewByteRef creates an unsafe byte slice reference to the given string . // The referenced data is not guaranteed to stay valid if no reference to the // original string is held anymore . The returned ByteRef does not count as // reference . // Writing to the returned ByteRef will result in a segfault .
func NewByteRef(a string) ByteRef {
	stringHeader := (*reflect.StringHeader)(unsafe.Pointer(&a))
	sliceHeader := &reflect.SliceHeader{
		Data: stringHeader.Data,
		Len:  stringHeader.Len,
		Cap:  stringHeader.Len,
	}
	return *(*ByteRef)(unsafe.Pointer(sliceHeader))
}
func NewByteRef ( a string ) ByteRef { stringHeader := ( * reflect . StringHeader ) ( unsafe . Pointer ( & a ) ) sliceHeader := & reflect . SliceHeader { Data : stringHeader . Data , Len : stringHeader . Len , Cap : stringHeader . Len , } return * ( * ByteRef ) ( unsafe . Pointer ( sliceHeader ) ) }
NewByteRef creates an unsafe byte slice reference to the given string.
NewByteRef creates an unsafe byte slice reference to the given string .