On this page
Trait std::ops::Not
pub trait Not {
type Output;
// Required method
fn not(self) -> Self::Output;
}
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
type Output
The resulting type after applying the !
operator.
Required Methods
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
impl Not for &bool
type Output = <bool as Not>::Output
impl Not for &i8
type Output = <i8 as Not>::Output
impl Not for &i16
type Output = <i16 as Not>::Output
impl Not for &i32
type Output = <i32 as Not>::Output
impl Not for &i64
type Output = <i64 as Not>::Output
impl Not for &i128
type Output = <i128 as Not>::Output
impl Not for &isize
type Output = <isize as Not>::Output
impl Not for &u8
type Output = <u8 as Not>::Output
impl Not for &u16
type Output = <u16 as Not>::Output
impl Not for &u32
type Output = <u32 as Not>::Output
impl Not for &u64
type Output = <u64 as Not>::Output
impl Not for &u128
type Output = <u128 as Not>::Output
impl Not for &usize
type Output = <usize as Not>::Output
impl Not for &Ipv4Addr
type Output = Ipv4Addr
impl Not for &Ipv6Addr
type Output = Ipv6Addr
impl Not for &Saturating<i8>
type Output = <Saturating<i8> as Not>::Output
impl Not for &Saturating<i16>
type Output = <Saturating<i16> as Not>::Output
impl Not for &Saturating<i32>
type Output = <Saturating<i32> as Not>::Output
impl Not for &Saturating<i64>
type Output = <Saturating<i64> as Not>::Output
impl Not for &Saturating<i128>
type Output = <Saturating<i128> as Not>::Output
impl Not for &Saturating<isize>
type Output = <Saturating<isize> as Not>::Output
impl Not for &Saturating<u8>
type Output = <Saturating<u8> as Not>::Output
impl Not for &Saturating<u16>
type Output = <Saturating<u16> as Not>::Output
impl Not for &Saturating<u32>
type Output = <Saturating<u32> as Not>::Output
impl Not for &Saturating<u64>
type Output = <Saturating<u64> as Not>::Output
impl Not for &Saturating<u128>
type Output = <Saturating<u128> as Not>::Output
impl Not for &Saturating<usize>
type Output = <Saturating<usize> as Not>::Output
impl Not for &Wrapping<i8>
type Output = <Wrapping<i8> as Not>::Output
impl Not for &Wrapping<i16>
type Output = <Wrapping<i16> as Not>::Output
impl Not for &Wrapping<i32>
type Output = <Wrapping<i32> as Not>::Output
impl Not for &Wrapping<i64>
type Output = <Wrapping<i64> as Not>::Output
impl Not for &Wrapping<i128>
type Output = <Wrapping<i128> as Not>::Output
impl Not for &Wrapping<isize>
type Output = <Wrapping<isize> as Not>::Output
impl Not for &Wrapping<u8>
type Output = <Wrapping<u8> as Not>::Output
impl Not for &Wrapping<u16>
type Output = <Wrapping<u16> as Not>::Output
impl Not for &Wrapping<u32>
type Output = <Wrapping<u32> as Not>::Output
impl Not for &Wrapping<u64>
type Output = <Wrapping<u64> as Not>::Output
impl Not for &Wrapping<u128>
type Output = <Wrapping<u128> as Not>::Output
impl Not for &Wrapping<usize>
type Output = <Wrapping<usize> as Not>::Output
impl Not for bool
type Output = bool
impl Not for i8
type Output = i8
impl Not for i16
type Output = i16
impl Not for i32
type Output = i32
impl Not for i64
type Output = i64
impl Not for i128
type Output = i128
impl Not for isize
type Output = isize
impl Not for !
type Output = !
impl Not for u8
type Output = u8
impl Not for u16
type Output = u16
impl Not for u32
type Output = u32
impl Not for u64
type Output = u64
impl Not for u128
type Output = u128
impl Not for usize
type Output = usize
impl Not for Ipv4Addr
type Output = Ipv4Addr
impl Not for Ipv6Addr
type Output = Ipv6Addr
impl Not for Saturating<i8>
type Output = Saturating<i8>
impl Not for Saturating<i16>
type Output = Saturating<i16>
impl Not for Saturating<i32>
type Output = Saturating<i32>
impl Not for Saturating<i64>
type Output = Saturating<i64>
impl Not for Saturating<i128>
type Output = Saturating<i128>
impl Not for Saturating<isize>
type Output = Saturating<isize>
impl Not for Saturating<u8>
type Output = Saturating<u8>
impl Not for Saturating<u16>
type Output = Saturating<u16>
impl Not for Saturating<u32>
type Output = Saturating<u32>
impl Not for Saturating<u64>
type Output = Saturating<u64>
impl Not for Saturating<u128>
type Output = Saturating<u128>
impl Not for Saturating<usize>
type Output = Saturating<usize>
impl Not for Wrapping<i8>
type Output = Wrapping<i8>
impl Not for Wrapping<i16>
type Output = Wrapping<i16>
impl Not for Wrapping<i32>
type Output = Wrapping<i32>
impl Not for Wrapping<i64>
type Output = Wrapping<i64>
impl Not for Wrapping<i128>
type Output = Wrapping<i128>
impl Not for Wrapping<isize>
type Output = Wrapping<isize>
impl Not for Wrapping<u8>
type Output = Wrapping<u8>
impl Not for Wrapping<u16>
type Output = Wrapping<u16>
impl Not for Wrapping<u32>
type Output = Wrapping<u32>
impl Not for Wrapping<u64>
type Output = Wrapping<u64>
impl Not for Wrapping<u128>
type Output = Wrapping<u128>
impl Not for Wrapping<usize>
type Output = Wrapping<usize>
impl<T, const LANES: usize> Not for Mask<T, LANES>
where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Mask<T, LANES>
impl<const LANES: usize> Not for Simd<i8, LANES>
where
i8: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<i8, LANES>
impl<const LANES: usize> Not for Simd<i16, LANES>
where
i16: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<i16, LANES>
impl<const LANES: usize> Not for Simd<i32, LANES>
where
i32: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<i32, LANES>
impl<const LANES: usize> Not for Simd<i64, LANES>
where
i64: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<i64, LANES>
impl<const LANES: usize> Not for Simd<isize, LANES>
where
isize: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<isize, LANES>
impl<const LANES: usize> Not for Simd<u8, LANES>
where
u8: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<u8, LANES>
impl<const LANES: usize> Not for Simd<u16, LANES>
where
u16: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<u16, LANES>
impl<const LANES: usize> Not for Simd<u32, LANES>
where
u32: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<u32, LANES>
impl<const LANES: usize> Not for Simd<u64, LANES>
where
u64: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<u64, LANES>
impl<const LANES: usize> Not for Simd<usize, LANES>
where
usize: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
type Output = Simd<usize, LANES>
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ops/trait.Not.html