cddl-codegen
                                
                                
                                
                                    cddl-codegen copied to clipboard
                            
                            
                            
                        Generic support for all types
For example in [a] or [* a] it seems only for generics we ignore the * and always end up with a single element array. In the non-generic case this is handled properly (I'm not sure which PR fixed this because it used to be an issue for non-generics too with it always interpreting [a] as [* a], i.e. the opposite problem as now)
Consider the following:
single_field_struct = [uint]
uint_array = [*uint]
generic_single_field_struct<a> = [a]
generic_array<a> = [*a]
occurence_test = [
	single_field_struct,
	uint_array,
	gen_single_field: generic_single_field_struct<uint>,
	gen_array: generic_array<uint>,
]
the fields single_field_struct and uint_array correctly generate as a single-uint struct and a Vec<uint> respectively, but the last two fields both generate as a single uint struct even though gen_array should be handled as a Vec<uint> here.
We should always respect the occurrence operators to decide what kind of array (expandable vs fixed single element) in all cases.
It seems this isn't limited to arrays. We should support generics in all types. We have a todo!() for T / null generics too. The current implementation doesn't resolve for RustType::GroupChoice or RustType::Wrapper but at least we should handle the types we claim to support (arrays/tables/type choices) without issues.