Expressing exponent for custom Struct

I have:

pub struct MathNode {}

I have also implemented traits relating to: +, -, *, /, ^

Unfortunately, the precedence level shown in is not what I want -- I'd prefer ^ to have higher precedence than all of +-*/

What is the best way to deal with this?

You can't change precedence, so you have to pick another operator that has the precedence you want, or live with a wrong precedence.

1 Like

Another way is to write a proc macro. You can design syntax whatever you want but a downside is that it can confuse code readers.