Build the composite key prefix: `[name_len: u8][name: bytes]`.
(array: &str)
| 32 | |
| 33 | /// Build the composite key prefix: `[name_len: u8][name: bytes]`. |
| 34 | fn name_prefix(array: &str) -> Option<Vec<u8>> { |
| 35 | let name_bytes = array.as_bytes(); |
| 36 | let len = u8::try_from(name_bytes.len()).ok()?; |
| 37 | let mut key = Vec::with_capacity(1 + name_bytes.len()); |
| 38 | key.push(len); |
| 39 | key.extend_from_slice(name_bytes); |
| 40 | Some(key) |
| 41 | } |
| 42 | |
| 43 | /// Build the composite op key: `[name_len: u8][name: bytes][hlc: 18]`. |
| 44 | fn op_key(array: &str, hlc: Hlc) -> Option<Vec<u8>> { |