```rust impl BinOp { pub fn to_str(&self) -> &str { match self { BinOp::Add

impl BinOp {
    pub fn to_str(&self) -> &str {
        match self {
            BinOp::Add => "+",
            BinOp::Sub => "-",
            BinOp::Mul => "*",
            BinOp::Div => "/",
            BinOp::Mod => "%",
            BinOp::And => "&&",
            BinOp::Or => "||",
            BinOp::Eq => "==",
            BinOp::BangEq => "!=",
            BinOp::Less => "<",
            BinOp::LessEq => "<=",
            BinOp::Greater => ">",
            BinOp::GreaterEq => ">=",
        }
    }
}
can somebody explain to me why rust code is filled with these match statements
Was this page helpful?