Trait sp_std::ops::Not

1.0.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§

source

type Output

The resulting type after applying the ! operator.

Required Methods§

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§

source§

impl Not for &bool

§

type Output = <bool as Not>::Output

source§

impl Not for &i8

§

type Output = <i8 as Not>::Output

source§

impl Not for &i16

§

type Output = <i16 as Not>::Output

source§

impl Not for &i32

§

type Output = <i32 as Not>::Output

source§

impl Not for &i64

§

type Output = <i64 as Not>::Output

source§

impl Not for &i128

§

type Output = <i128 as Not>::Output

source§

impl Not for &isize

§

type Output = <isize as Not>::Output

source§

impl Not for &u8

§

type Output = <u8 as Not>::Output

source§

impl Not for &u16

§

type Output = <u16 as Not>::Output

source§

impl Not for &u32

§

type Output = <u32 as Not>::Output

source§

impl Not for &u64

§

type Output = <u64 as Not>::Output

source§

impl Not for &u128

§

type Output = <u128 as Not>::Output

source§

impl Not for &usize

§

type Output = <usize as Not>::Output

source§

impl Not for &Saturating<i8>

source§

impl Not for &Saturating<i16>

source§

impl Not for &Saturating<i32>

source§

impl Not for &Saturating<i64>

source§

impl Not for &Saturating<i128>

source§

impl Not for &Saturating<isize>

source§

impl Not for &Saturating<u8>

source§

impl Not for &Saturating<u16>

source§

impl Not for &Saturating<u32>

source§

impl Not for &Saturating<u64>

source§

impl Not for &Saturating<u128>

source§

impl Not for &Saturating<usize>

1.14.0 · source§

impl Not for &Wrapping<i8>

§

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

1.14.0 · source§

impl Not for &Wrapping<i16>

1.14.0 · source§

impl Not for &Wrapping<i32>

1.14.0 · source§

impl Not for &Wrapping<i64>

1.14.0 · source§

impl Not for &Wrapping<i128>

1.14.0 · source§

impl Not for &Wrapping<isize>

1.14.0 · source§

impl Not for &Wrapping<u8>

§

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

1.14.0 · source§

impl Not for &Wrapping<u16>

1.14.0 · source§

impl Not for &Wrapping<u32>

1.14.0 · source§

impl Not for &Wrapping<u64>

1.14.0 · source§

impl Not for &Wrapping<u128>

1.14.0 · source§

impl Not for &Wrapping<usize>

source§

impl Not for bool

§

type Output = bool

source§

impl Not for i8

§

type Output = i8

source§

impl Not for i16

§

type Output = i16

source§

impl Not for i32

§

type Output = i32

source§

impl Not for i64

§

type Output = i64

source§

impl Not for i128

§

type Output = i128

source§

impl Not for isize

1.60.0 · source§

impl Not for !

§

type Output = !

source§

impl Not for u8

§

type Output = u8

source§

impl Not for u16

§

type Output = u16

source§

impl Not for u32

§

type Output = u32

source§

impl Not for u64

§

type Output = u64

source§

impl Not for u128

§

type Output = u128

source§

impl Not for usize

source§

impl Not for Saturating<i8>

source§

impl Not for Saturating<i16>

source§

impl Not for Saturating<i32>

source§

impl Not for Saturating<i64>

source§

impl Not for Saturating<i128>

source§

impl Not for Saturating<isize>

source§

impl Not for Saturating<u8>

source§

impl Not for Saturating<u16>

source§

impl Not for Saturating<u32>

source§

impl Not for Saturating<u64>

source§

impl Not for Saturating<u128>

source§

impl Not for Saturating<usize>

source§

impl Not for Wrapping<i8>

source§

impl Not for Wrapping<i16>

source§

impl Not for Wrapping<i32>

source§

impl Not for Wrapping<i64>

source§

impl Not for Wrapping<i128>

source§

impl Not for Wrapping<isize>

source§

impl Not for Wrapping<u8>

source§

impl Not for Wrapping<u16>

source§

impl Not for Wrapping<u32>

source§

impl Not for Wrapping<u64>

source§

impl Not for Wrapping<u128>

source§

impl Not for Wrapping<usize>

source§

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

§

type Output = Mask<T, LANES>

source§

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

§

type Output = Simd<i8, LANES>

source§

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

§

type Output = Simd<i16, LANES>

source§

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

§

type Output = Simd<i32, LANES>

source§

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

§

type Output = Simd<i64, LANES>

source§

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

§

type Output = Simd<isize, LANES>

source§

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

§

type Output = Simd<u8, LANES>

source§

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

§

type Output = Simd<u16, LANES>

source§

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

§

type Output = Simd<u32, LANES>

source§

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

§

type Output = Simd<u64, LANES>

source§

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

§

type Output = Simd<usize, LANES>

impl<M, T, O> Not for BitRef<'_, M, T, O>where M: Mutability, T: BitStore, O: BitOrder,

impl<A, O> Not for BitArray<A, O>where A: BitViewSized, O: BitOrder,

impl<'a, T, O> Not for &'a mut BitSlice<T, O>where T: BitStore, O: BitOrder,

impl<T, O> Not for BitBox<T, O>where T: BitStore, O: BitOrder,

impl<T, O> Not for BitVec<T, O>where T: BitStore, O: BitOrder,

impl<R> Not for BitMask<R>where R: BitRegister,

impl<const LIMBS: usize> Not for Wrapping<UInt<LIMBS>>

impl<const LIMBS: usize> Not for UInt<LIMBS>

impl Not for Limb

impl<T> Not for BitFlags<T>where T: BitFlag,

impl Not for &Boolean

impl Not for &Number

impl Not for BigInt

impl Not for Boolean

impl Not for Number

impl Not for &BigInt

impl Not for Endpoint

impl Not for BigInt

impl<'a> Not for &'a BigInt

impl Not for U256

impl Not for U128

impl Not for U512

impl Not for DupFlags

impl Not for CloneFlags

impl Not for Access

impl Not for OFlags

impl Not for Mode

impl Not for FdFlags

impl Not for AtFlags

impl Not for PollFlags

impl Not for Roles

impl Not for Flags

impl Not for TrustOptions

impl Not for Flags

impl Not for AutoSimd<[bool; 32]>

impl Not for AutoSimd<[bool; 4]>

impl Not for AutoSimd<[bool; 1]>

impl Not for AutoSimd<[bool; 2]>

impl Not for AutoSimd<[bool; 8]>

impl Not for AutoSimd<[bool; 16]>

impl Not for Capabilities

impl Not for Phase

impl Not for Choice

impl Not for B1

impl Not for B0

impl Not for &JsValue

impl Not for JsValue