pub trait Not {
type Output;
// Required method
fn not(self) -> Self::Output;
}
Expand description
The unary logical negation operator !
.
§Examples
An implementation of Not
for Answer
, which enables the use of !
to
invert its value.
use std::ops::Not;
#[derive(Debug, PartialEq)]
enum Answer {
Yes,
No,
}
impl Not for Answer {
type Output = Self;
fn not(self) -> Self::Output {
match self {
Answer::Yes => Answer::No,
Answer::No => Answer::Yes
}
}
}
assert_eq!(!Answer::Yes, Answer::No);
assert_eq!(!Answer::No, Answer::Yes);
Required Associated Types§
Required Methods§
Implementors§
1.74.0 (const: unstable) · Source§impl Not for Saturating<i128>
impl Not for Saturating<i128>
type Output = Saturating<i128>
1.74.0 (const: unstable) · Source§impl Not for Saturating<isize>
impl Not for Saturating<isize>
type Output = Saturating<isize>
1.74.0 (const: unstable) · Source§impl Not for Saturating<u128>
impl Not for Saturating<u128>
type Output = Saturating<u128>
1.74.0 (const: unstable) · Source§impl Not for Saturating<usize>
impl Not for Saturating<usize>
type Output = Saturating<usize>
Source§impl Not for CipherCtxFlags
impl Not for CipherCtxFlags
type Output = CipherCtxFlags
Source§impl Not for CMSOptions
impl Not for CMSOptions
type Output = CMSOptions
Source§impl Not for Pkcs7Flags
impl Not for Pkcs7Flags
type Output = Pkcs7Flags
Source§impl Not for ExtensionContext
impl Not for ExtensionContext
type Output = ExtensionContext
Source§impl Not for ShutdownState
impl Not for ShutdownState
type Output = ShutdownState
Source§impl Not for SslOptions
impl Not for SslOptions
type Output = SslOptions
Source§impl Not for SslSessionCacheMode
impl Not for SslSessionCacheMode
type Output = SslSessionCacheMode
Source§impl Not for SslVerifyMode
impl Not for SslVerifyMode
type Output = SslVerifyMode
Source§impl Not for X509CheckFlags
impl Not for X509CheckFlags
type Output = X509CheckFlags
Source§impl Not for X509VerifyFlags
impl Not for X509VerifyFlags
type Output = X509VerifyFlags
Source§impl<'a, T, O> Not for &'a mut BitSlice<T, O>
Inverts each bit in the bit-slice.
impl<'a, T, O> Not for &'a mut BitSlice<T, O>
Inverts each bit in the bit-slice.
Unlike the &
, |
, and ^
operators, this implementation is guaranteed to
update each memory element only once, and is not required to traverse every live
bit in the underlying region.
Source§impl<T, O> Not for BitVec<T, O>
This implementation inverts all elements in the live buffer. You cannot rely
on the value of bits in the buffer that are outside the domain of
BitVec::as_mut_bitslice
.
impl<T, O> Not for BitVec<T, O>
This implementation inverts all elements in the live buffer. You cannot rely
on the value of bits in the buffer that are outside the domain of
BitVec::as_mut_bitslice
.