Compile-time function constraints evaluation

67 Views Asked by At

Is there any way to instruct the compiler to check if a function respects some constraints? For example I would like to use functions Fn(f64) -> f64 that are guaranteed to evaluate to -1.0 and 1.0 on the boundaries of a range (e.g. when the argument is 0.0 or 1.0). I'm aware of const_guards but it seems to me that I would need generic constant functions and I think they're not supported yet. Are there any other solutions?

0

There are 0 best solutions below