pdl: Avoid unwrap when parsing arrays
Because https://doc.rust-lang.org/std/array/fn.try_from_fn.html is not yet stable, we do this by collecting the intermediate values into a Vec, which we turn into an array. Alternatives would be to emit an array literal (can be a lot more code), use MaybeUninit (unsafe, can leak memory) or to let all structs and enums implement Default (extra code, need to pick a default for enums). The generated test files now have 94 explicit unwraps. They are all due to the API and the way it emulates inheritance and OOP. Tag: #feature Bug: 279758009 Test: atest pdl_tests pdl_rust_generator_tests_{le,be} pdl_generated_files_compile Change-Id: I84a780d703079940642664e462deadd8ed335ec6
Loading
Please register or sign in to comment