No, this is just overcomplicating things. Like Peter said, just use arrays. Copying from the V1 review for reference:
const UART_PCELL_ID: [u8; 4] = [0x0d, 0xf0, 0x05, 0xb1];
const ARM_UART_PERIPH_ID: [u8; 4] = [0x11, 0x10, 0x14, 0x00];
const LUMINARY_UART_PERIPH_ID: [u8; 4] = [0x11, 0x00, 0x18, 0x01];
/// Value of `UARTPeriphID0` through `UARTPeriphID3` registers
const fn uart_periph_id(&self, idx: usize) -> u8 {
match self {
Self::Arm => ARM_UART_PERIPH_ID,
Self::Luminary => LUMINARY_UART_PERIPH_ID,
}[idx]
}
/// Value of `UARTPCellID0` through `UARTPCellID3` registers
const fn uart_pcell_id(idx: usize) -> u8 {
Self::UART_PCELL_ID[idx]
}
Paolo