I have the following code
pub const EXP: u32 = 4;
pub const POW: u32 = 3u32.pow(EXP);
This fails to compile since I'm using an expression:
src/t.rs:4:22: 4:35 error: constant contains unimplemented expression type [E0019]
src/t.rs:4 pub const POW: u32 = 3u32.pow(EXP);
^~~~~~~~~~~~~
Can I have this value (3 ** EXP) be a constant in any other way? I can only think, at the moment, to have a function
#[inline(always)]
pub fn POW() -> { 3u32.pow(EXP); }
but I was wondering if it can be done with the constants as well.