#[lang = "not"] pub trait Not { type Output; fn not(self) -> Self::Output; }
The unary logical negation operator !
.
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 = Answer; fn not(self) -> Answer { match self { Answer::Yes => Answer::No, Answer::No => Answer::Yes } } } assert_eq!(!Answer::Yes, Answer::No); assert_eq!(!Answer::No, Answer::Yes);
type Output
The resulting type after applying the !
operator.
impl<'a> Not for &'a Wrapping<isize> type Output = <Wrapping<isize> as Not>::Output;
impl Not for u64 type Output = u64;
impl<'a> Not for &'a Wrapping<u16> type Output = <Wrapping<u16> as Not>::Output;
impl<'a> Not for &'a u16 type Output = <u16 as Not>::Output;
impl Not for i32 type Output = i32;
impl Not for Wrapping<u8> type Output = Wrapping<u8>;
impl<'a> Not for &'a Wrapping<i64> type Output = <Wrapping<i64> as Not>::Output;
impl<'a> Not for &'a usize type Output = <usize as Not>::Output;
impl<'a> Not for &'a i8 type Output = <i8 as Not>::Output;
impl Not for i128 type Output = i128;
impl<'a> Not for &'a Wrapping<usize> type Output = <Wrapping<usize> as Not>::Output;
impl Not for Wrapping<u128> type Output = Wrapping<u128>;
impl<'a> Not for &'a Wrapping<u8> type Output = <Wrapping<u8> as Not>::Output;
impl Not for Wrapping<u32> type Output = Wrapping<u32>;
impl<'a> Not for &'a Wrapping<u64> type Output = <Wrapping<u64> as Not>::Output;
impl<'a> Not for &'a i32 type Output = <i32 as Not>::Output;
impl Not for i8 type Output = i8;
impl Not for u8 type Output = u8;
impl<'a> Not for &'a Wrapping<i8> type Output = <Wrapping<i8> as Not>::Output;
impl<'a> Not for &'a u32 type Output = <u32 as Not>::Output;
impl Not for u16 type Output = u16;
impl<'a> Not for &'a u64 type Output = <u64 as Not>::Output;
impl<'a> Not for &'a Wrapping<i16> type Output = <Wrapping<i16> as Not>::Output;
impl Not for Wrapping<i128> type Output = Wrapping<i128>;
impl Not for Wrapping<isize> type Output = Wrapping<isize>;
impl Not for Wrapping<i32> type Output = Wrapping<i32>;
impl Not for usize type Output = usize;
impl Not for Wrapping<i16> type Output = Wrapping<i16>;
impl<'a> Not for &'a Wrapping<u32> type Output = <Wrapping<u32> as Not>::Output;
impl Not for bool type Output = bool;
impl<'a> Not for &'a u8 type Output = <u8 as Not>::Output;
impl<'a> Not for &'a i16 type Output = <i16 as Not>::Output;
impl<'a> Not for &'a Wrapping<u128> type Output = <Wrapping<u128> as Not>::Output;
impl<'a> Not for &'a isize type Output = <isize as Not>::Output;
impl Not for i64 type Output = i64;
impl<'a> Not for &'a u128 type Output = <u128 as Not>::Output;
impl<'a> Not for &'a i64 type Output = <i64 as Not>::Output;
impl Not for isize type Output = isize;
impl Not for Wrapping<u64> type Output = Wrapping<u64>;
impl Not for Wrapping<u16> type Output = Wrapping<u16>;
impl<'a> Not for &'a Wrapping<i32> type Output = <Wrapping<i32> as Not>::Output;
impl<'a> Not for &'a bool type Output = <bool as Not>::Output;
impl Not for u32 type Output = u32;
impl Not for Wrapping<usize> type Output = Wrapping<usize>;
impl Not for Wrapping<i8> type Output = Wrapping<i8>;
impl Not for i16 type Output = i16;
impl<'a> Not for &'a Wrapping<i128> type Output = <Wrapping<i128> as Not>::Output;
impl Not for Wrapping<i64> type Output = Wrapping<i64>;
impl<'a> Not for &'a i128 type Output = <i128 as Not>::Output;
impl Not for u128 type Output = u128;
© 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