I have an enum like so:
#[repr(u8)]
enum OpCode {
Return = 0,
}
And some data:
let code= vec![0u8];
Is it possible to mathc using a syntax like:
match code.get(0).unwrap().clone() {
OpCode::Return as u8 => {
println!("Return")
}
x => {}
}
Instead of
match code.get(0).unwrap().clone() {
x if x == OpCode::Return as u8 => {
println!("Return")
}
}