这个:
有没有一种方法可以做到这一点?我想要做的是:
const fn pow2(exp: u32) -> u32 {
u32::pow(exp, 2)
}
编译器报错:
error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors
有没有一种方法可以做到这一点?我想要做的是:
pub const MY_BITMASK: u32 = pow2(4);