Macros and const

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.

Yes, the const len value has to be known at compile time, but the parameter of get_me_the_type is only known at runtime.

Here's an example macro. You can expand the macro under Tools.

If <some type> is dependent on the const len, it's not going to work: get_me_type_type can only return a single type.