MCPcopy Create free account
hub / github.com/brimdata/super / UnsafeString

Function UnsafeString

pkg/byteconv/byteconv.go:14–16  ·  view source on GitHub ↗

UnsafeString converts a byte slice to a string without copying the underlying data. Unsafe string coversion is OK when calling some other function that doesn't store the string and otherwise never uses the string again.

(b []byte)

Source from the content-addressed store, hash-verified

12// data. Unsafe string coversion is OK when calling some other function that
13// doesn't store the string and otherwise never uses the string again.
14func UnsafeString(b []byte) string {
15 return *(*string)(unsafe.Pointer(&b))
16}
17
18func ParseBool(b []byte) (bool, error) {
19 return strconv.ParseBool(UnsafeString(b))

Callers 15

UnsafeStringMethod · 0.92
stringToDurationFunction · 0.92
stringToTimeFunction · 0.92
EvalMethod · 0.92
NewSearchStringFunction · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
NewFieldNameFinderFunction · 0.92
CompareStringFunction · 0.92
EvalMethod · 0.92
ParseBoolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected