(strings: &[&[u8]])
| 59 | #[doc(hidden)] |
| 60 | #[must_use] |
| 61 | pub const fn decode<const LEN: usize>(strings: &[&[u8]]) -> Option<[u8; LEN]> { |
| 62 | let mut string_pos = 0; |
| 63 | let mut buf = [0u8; LEN]; |
| 64 | let mut buf_pos = 0; |
| 65 | while string_pos < strings.len() { |
| 66 | let mut pos = 0; |
| 67 | let string = &strings[string_pos]; |
| 68 | string_pos += 1; |
| 69 | |
| 70 | while let Some((byte, new_pos)) = next_byte(string, pos) { |
| 71 | buf[buf_pos] = byte; |
| 72 | buf_pos += 1; |
| 73 | pos = new_pos; |
| 74 | } |
| 75 | } |
| 76 | if LEN == buf_pos { Some(buf) } else { None } |
| 77 | } |
| 78 | |
| 79 | /// Converts a sequence of hexadecimal string literals to a byte array at compile time. |
| 80 | /// |
no test coverage detected