Build the name-prefix used for range scans: `[name_len: u8][name bytes]`.
(array: &str)
| 42 | |
| 43 | /// Build the name-prefix used for range scans: `[name_len: u8][name bytes]`. |
| 44 | fn name_prefix(array: &str) -> Option<Vec<u8>> { |
| 45 | let name_bytes = array.as_bytes(); |
| 46 | let name_len = u8::try_from(name_bytes.len()).ok()?; |
| 47 | let mut prefix = Vec::with_capacity(1 + name_bytes.len()); |
| 48 | prefix.push(name_len); |
| 49 | prefix.extend_from_slice(name_bytes); |
| 50 | Some(prefix) |
| 51 | } |
| 52 | |
| 53 | /// Parse the HLC from the tail of a composite key given the prefix length. |
| 54 | fn hlc_from_key(key: &[u8], prefix_len: usize) -> Option<Hlc> { |
no test coverage detected