Bytes2String converts []byte to string via direct pointer conversion. Both share the same underlying memory; modifying one affects the other. Much faster than string([]byte{}) for large conversions.
(b []byte)
| 435 | // Both share the same underlying memory; modifying one affects the other. |
| 436 | // Much faster than string([]byte{}) for large conversions. |
| 437 | func Bytes2String(b []byte) string { |
| 438 | return *(*string)(unsafe.Pointer(&b)) |
| 439 | } |
| 440 | |
| 441 | // String2Bytes converts string to []byte via direct pointer conversion. |
| 442 | // Both share the same underlying memory; modifying one affects the other. |
no outgoing calls