expr_parser/
operator.rs

1#[derive(Clone, Copy, Debug)]
2pub enum Fixity<P> {
3    Left(P),
4    Right(P),
5}
6
7impl<P> Fixity<P> {
8    pub fn precedence(&self) -> &P {
9        match self {
10            Fixity::Left(prec) | Fixity::Right(prec) => prec,
11        }
12    }
13
14    pub fn into_precedence(self) -> P {
15        match self {
16            Fixity::Left(prec) | Fixity::Right(prec) => prec,
17        }
18    }
19}