I have the following const generic function and I want to invoke get_me_the_type() :
fn new<const len : usize>() -> <some type> {
}
fn get_me_the_type(len : usize) -> <some type> {
// I want to do the following but I can't
return new::<len>();
// I need to do the following to get this to work
match len {
4 => new::<4>(),
8 => new::<8>(),
_ => new::<0>(),
}
}
This seems ugly. Ideally a macro would be awesome but how do I handle const in a macro? Thanks in advance.