Is there a way to have a reference to a compare operator or function in Rust to compare some values? So what I have in my mind would be ...
enum SomeEnum {
A,
B,
}
let some_enum = SomeEnum::A;
let a = 1;
let b = 2;
// What would be nice ...
let op = match some_enum {
SomeEnum::A => {
ge_operator // return greater_equal operator - how could this work?
}
SomeEnum::B => {
ls_operator // return less operator - how could this work?
}
};
let test = if a op b {
'X'
} else {
'Y'
};