Not in core::ops - Rust
Description: The unary logical negation operator `!`.

# Trait Not

1.6.0 · Source

    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§

1.0.0 · Source

#### type Output

The resulting type after applying the `!` operator.

## Required Methods§

1.0.0 · Source

#### fn not(self) -> Self::Output

Performs the unary `!` operation.

##### §Examples

    assert_eq!(!true, false);
    assert_eq!(!false, true);
    assert_eq!(!1u8, 254);
    assert_eq!(!0u8, 255);

## Implementors§

1.0.0 · Source§

### impl Not for &bool

Source§

#### type Output = <bool as Not>::Output

1.0.0 · Source§

### impl Not for &i8

Source§

#### type Output = <i8 as Not>::Output

1.0.0 · Source§

### impl Not for &i16

Source§

#### type Output = <i16 as Not>::Output

1.0.0 · Source§

### impl Not for &i32

Source§

#### type Output = <i32 as Not>::Output

1.0.0 · Source§

### impl Not for &i64

Source§

#### type Output = <i64 as Not>::Output

1.0.0 · Source§

### impl Not for &i128

Source§

#### type Output = <i128 as Not>::Output

1.0.0 · Source§

### impl Not for &isize

Source§

#### type Output = <isize as Not>::Output

1.0.0 · Source§

### impl Not for &u8

Source§

#### type Output = <u8 as Not>::Output

1.0.0 · Source§

### impl Not for &u16

Source§

#### type Output = <u16 as Not>::Output

1.0.0 · Source§

### impl Not for &u32

Source§

#### type Output = <u32 as Not>::Output

1.0.0 · Source§

### impl Not for &u64

Source§

#### type Output = <u64 as Not>::Output

1.0.0 · Source§

### impl Not for &u128

Source§

#### type Output = <u128 as Not>::Output

1.0.0 · Source§

### impl Not for &usize

Source§

#### type Output = <usize as Not>::Output

1.75.0 · Source§

### impl Not for &Ipv4Addr

Source§

#### type Output = Ipv4Addr

1.75.0 · Source§

### impl Not for &Ipv6Addr

Source§

#### type Output = Ipv6Addr

1.74.0 · Source§

### impl Not for &Saturating<i8>

Source§

#### type Output = <Saturating<i8> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<i16>

Source§

#### type Output = <Saturating<i16> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<i32>

Source§

#### type Output = <Saturating<i32> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<i64>

Source§

#### type Output = <Saturating<i64> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<i128>

Source§

#### type Output = <Saturating<i128> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<isize>

Source§

#### type Output = <Saturating<isize> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<u8>

Source§

#### type Output = <Saturating<u8> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<u16>

Source§

#### type Output = <Saturating<u16> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<u32>

Source§

#### type Output = <Saturating<u32> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<u64>

Source§

#### type Output = <Saturating<u64> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<u128>

Source§

#### type Output = <Saturating<u128> as Not>::Output

1.74.0 · Source§

### impl Not for &Saturating<usize>

Source§

#### type Output = <Saturating<usize> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<i8>

Source§

#### type Output = <Wrapping<i8> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<i16>

Source§

#### type Output = <Wrapping<i16> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<i32>

Source§

#### type Output = <Wrapping<i32> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<i64>

Source§

#### type Output = <Wrapping<i64> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<i128>

Source§

#### type Output = <Wrapping<i128> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<isize>

Source§

#### type Output = <Wrapping<isize> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<u8>

Source§

#### type Output = <Wrapping<u8> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<u16>

Source§

#### type Output = <Wrapping<u16> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<u32>

Source§

#### type Output = <Wrapping<u32> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<u64>

Source§

#### type Output = <Wrapping<u64> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<u128>

Source§

#### type Output = <Wrapping<u128> as Not>::Output

1.14.0 · Source§

### impl Not for &Wrapping<usize>

Source§

#### type Output = <Wrapping<usize> as Not>::Output

1.0.0 · Source§

### impl Not for bool

Source§

#### type Output = bool

1.0.0 · Source§

### impl Not for i8

Source§

#### type Output = i8

1.0.0 · Source§

### impl Not for i16

Source§

#### type Output = i16

1.0.0 · Source§

### impl Not for i32

Source§

#### type Output = i32

1.0.0 · Source§

### impl Not for i64

Source§

#### type Output = i64

1.0.0 · Source§

### impl Not for i128

Source§

#### type Output = i128

1.0.0 · Source§

### impl Not for isize

Source§

#### type Output = isize

1.60.0 · Source§

### impl Not for !

Source§

#### type Output = !

1.0.0 · Source§

### impl Not for u8

Source§

#### type Output = u8

1.0.0 · Source§

### impl Not for u16

Source§

#### type Output = u16

1.0.0 · Source§

### impl Not for u32

Source§

#### type Output = u32

1.0.0 · Source§

### impl Not for u64

Source§

#### type Output = u64

1.0.0 · Source§

### impl Not for u128

Source§

#### type Output = u128

1.0.0 · Source§

### impl Not for usize

Source§

#### type Output = usize

1.75.0 · Source§

### impl Not for Ipv4Addr

Source§

#### type Output = Ipv4Addr

1.75.0 · Source§

### impl Not for Ipv6Addr

Source§

#### type Output = Ipv6Addr

1.74.0 · Source§

### impl Not for Saturating<i8>

Source§

#### type Output = Saturating<i8>

1.74.0 · Source§

### impl Not for Saturating<i16>

Source§

#### type Output = Saturating<i16>

1.74.0 · Source§

### impl Not for Saturating<i32>

Source§

#### type Output = Saturating<i32>

1.74.0 · Source§

### impl Not for Saturating<i64>

Source§

#### type Output = Saturating<i64>

1.74.0 · Source§

### impl Not for Saturating<i128>

Source§

#### type Output = Saturating<i128>

1.74.0 · Source§

### impl Not for Saturating<isize>

Source§

#### type Output = Saturating<isize>

1.74.0 · Source§

### impl Not for Saturating<u8>

Source§

#### type Output = Saturating<u8>

1.74.0 · Source§

### impl Not for Saturating<u16>

Source§

#### type Output = Saturating<u16>

1.74.0 · Source§

### impl Not for Saturating<u32>

Source§

#### type Output = Saturating<u32>

1.74.0 · Source§

### impl Not for Saturating<u64>

Source§

#### type Output = Saturating<u64>

1.74.0 · Source§

### impl Not for Saturating<u128>

Source§

#### type Output = Saturating<u128>

1.74.0 · Source§

### impl Not for Saturating<usize>

Source§

#### type Output = Saturating<usize>

1.0.0 · Source§

### impl Not for Wrapping<i8>

Source§

#### type Output = Wrapping<i8>

1.0.0 · Source§

### impl Not for Wrapping<i16>

Source§

#### type Output = Wrapping<i16>

1.0.0 · Source§

### impl Not for Wrapping<i32>

Source§

#### type Output = Wrapping<i32>

1.0.0 · Source§

### impl Not for Wrapping<i64>

Source§

#### type Output = Wrapping<i64>

1.0.0 · Source§

### impl Not for Wrapping<i128>

Source§

#### type Output = Wrapping<i128>

1.0.0 · Source§

### impl Not for Wrapping<isize>

Source§

#### type Output = Wrapping<isize>

1.0.0 · Source§

### impl Not for Wrapping<u8>

Source§

#### type Output = Wrapping<u8>

1.0.0 · Source§

### impl Not for Wrapping<u16>

Source§

#### type Output = Wrapping<u16>

1.0.0 · Source§

### impl Not for Wrapping<u32>

Source§

#### type Output = Wrapping<u32>

1.0.0 · Source§

### impl Not for Wrapping<u64>

Source§

#### type Output = Wrapping<u64>

1.0.0 · Source§

### impl Not for Wrapping<u128>

Source§

#### type Output = Wrapping<u128>

1.0.0 · Source§

### impl Not for Wrapping<usize>

Source§

#### type Output = Wrapping<usize>

Source§

### impl<T, const N: usize> Not for Mask<T, N>
where T: MaskElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Mask<T, N>

Source§

### impl<const N: usize> Not for Simd<i8, N>
where i8: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<i8, N>

Source§

### impl<const N: usize> Not for Simd<i16, N>
where i16: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<i16, N>

Source§

### impl<const N: usize> Not for Simd<i32, N>
where i32: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<i32, N>

Source§

### impl<const N: usize> Not for Simd<i64, N>
where i64: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<i64, N>

Source§

### impl<const N: usize> Not for Simd<isize, N>
where isize: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<isize, N>

Source§

### impl<const N: usize> Not for Simd<u8, N>
where u8: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<u8, N>

Source§

### impl<const N: usize> Not for Simd<u16, N>
where u16: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<u16, N>

Source§

### impl<const N: usize> Not for Simd<u32, N>
where u32: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<u32, N>

Source§

### impl<const N: usize> Not for Simd<u64, N>
where u64: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<u64, N>

Source§

### impl<const N: usize> Not for Simd<usize, N>
where usize: SimdElement, LaneCount<N>: SupportedLaneCount,

Source§

#### type Output = Simd<usize, N>