MCPcopy Create free account
hub / github.com/deventlab/d-engine / u64_to_bytes

Function u64_to_bytes

d-engine-core/src/utils/convert.rs:18–21  ·  view source on GitHub ↗

Convert to big-endian bytes with a single allocation

(value: u64)

Source from the content-addressed store, hash-verified

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

Callers 2

test_u64_to_bytesFunction · 0.85
safe_kv_bytesFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_u64_to_bytesFunction · 0.68