In Java, I could do this.
int diff = 'Z' - 'A'; // 25
I have tried the same in Rust:
fn main() {
'Z' - 'A';
}
but the compiler complains:
error[E0369]: binary operation `-` cannot be applied to type `char`
--> src/main.rs:2:5
|
2 | 'Z' - 'A';
| ^^^^^^^^^
|
= note: an implementation of `std::ops::Sub` might be missing for `char`
How can I do the equivalent operation in Rust?