Not

The Not trait enables the logical negation operator, which is written as an !. Not is both conceptually and practically similar to Neg, but its primary use is for Boolean logic rather than arithmetic.

Implementing Not looks like this:

pub enum NotExample {
True,
False,
}

impl Not for NotExample {
type Output = NotExample;

fn not(self) -> NotExample {
match self {
NotExample::True => NotExample::False,
NotExample::False => NotExample::True,
}
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.189.228