Convert to big-endian bytes with a single allocation
(value: u64)
| 16 | |
| 17 | // Convert to big-endian bytes with a single allocation |
| 18 | pub fn u64_to_bytes(value: u64) -> Bytes { |
| 19 | let bytes = value.to_be_bytes(); |
| 20 | Bytes::copy_from_slice(&bytes) |
| 21 | } |
| 22 | |
| 23 | pub fn safe_kv_bytes(key: u64) -> Bytes { |
| 24 | u64_to_bytes(key) |
no outgoing calls