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