Trait scale_info::prelude::ops::Not
1.0.0 · source · 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§
source§impl Not for Saturating<i8>
impl Not for Saturating<i8>
type Output = Saturating<i8>
source§impl Not for Saturating<i16>
impl Not for Saturating<i16>
type Output = Saturating<i16>
source§impl Not for Saturating<i32>
impl Not for Saturating<i32>
type Output = Saturating<i32>
source§impl Not for Saturating<i64>
impl Not for Saturating<i64>
type Output = Saturating<i64>
source§impl Not for Saturating<i128>
impl Not for Saturating<i128>
type Output = Saturating<i128>
source§impl Not for Saturating<isize>
impl Not for Saturating<isize>
type Output = Saturating<isize>
source§impl Not for Saturating<u8>
impl Not for Saturating<u8>
type Output = Saturating<u8>
source§impl Not for Saturating<u16>
impl Not for Saturating<u16>
type Output = Saturating<u16>
source§impl Not for Saturating<u32>
impl Not for Saturating<u32>
type Output = Saturating<u32>
source§impl Not for Saturating<u64>
impl Not for Saturating<u64>
type Output = Saturating<u64>
source§impl Not for Saturating<u128>
impl Not for Saturating<u128>
type Output = Saturating<u128>
source§impl Not for Saturating<usize>
impl Not for Saturating<usize>
type Output = Saturating<usize>
source§impl<'a, T, O> Not for &'a mut BitSlice<T, O>where
T: BitStore,
O: BitOrder,
impl<'a, T, O> Not for &'a mut BitSlice<T, O>where
T: BitStore,
O: BitOrder,
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>where
T: BitStore,
O: BitOrder,
impl<T, O> Not for BitVec<T, O>where
T: BitStore,
O: BitOrder,
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
.