1 | //! Reimplements some stuff from concatcp to be const generic instead of macro generated |
2 | |
3 | use crate::pmr::{LenAndArray, PArgument, PVariant}; |
4 | |
5 | #[doc (hidden)] |
6 | pub const fn __priv_concatenate<const LEN: usize>(input: &[PArgument]) -> LenAndArray<[u8; LEN]> { |
7 | let mut out: LenAndArray<[u8; LEN]> = LenAndArray { |
8 | len: 0, |
9 | array: [0u8; LEN], |
10 | }; |
11 | |
12 | crate::__for_range! { outer_i in 0..input.len() => |
13 | let current = &input[outer_i]; |
14 | |
15 | match current.elem { |
16 | PVariant::Str(s) => crate::__write_pvariant!(str, current, s => out), |
17 | PVariant::Int(int) => crate::__write_pvariant!(int, current, int => out), |
18 | PVariant::Char(c) => crate::__write_pvariant!(char, current, c => out), |
19 | } |
20 | } |
21 | |
22 | out |
23 | } |
24 | |