An implementation of Neg for Sign, which allows the use of - to
negate its value.
#[derive(Copy, Drop, PartialEq)]enum Sign { Negative, Zero, Positive,}impl SignNeg of Neg { fn neg(a: Sign) -> Sign { match a { Sign::Negative => Sign::Positive, Sign::Zero => Sign::Zero, Sign::Positive => Sign::Negative, } }}// A negative positive is a negativeassert!(-Sign::Positive == Sign::Negative);// A double negative is a positiveassert!(-Sign::Negative == Sign::Positive);// Zero is its own negationassert!(-Sign::Zero == Sign::Zero);