B2S converts byte slice to a string without memory allocation.
(b []byte)
| 12 | |
| 13 | // B2S converts byte slice to a string without memory allocation. |
| 14 | func B2S(b []byte) string { |
| 15 | size := len(b) |
| 16 | if size == 0 { |
| 17 | return "" |
| 18 | } |
| 19 | return unsafe.String(&b[0], size) |
| 20 | } |
| 21 | |
| 22 | // S2B converts string to a byte slice without memory allocation. |
| 23 | // |
no test coverage detected