I'm just learning Rust, and I was wondering if there is a possibility of taking this code:
match letter.to_lowercase().as_str() {
"a" => 5,
"n" => 13,
// And so on...
_ => 0,
}
and using String::eq_ignore_ascii_case
as the equality operator instead, like in the pseudocode below:
match letter with letter.eq_ignore_ascii_case as operator {
"a" => 5,
"n" => 13,
// And so on...
_ => 0,
}
Can this be done? If so, how?