Trait tract_hir::internal::tract_downcast_rs::__std::ops::Neg 1.0.0[−][src]
The unary negation operator -
.
Examples
An implementation of Neg
for Sign
, which allows the use of -
to
negate its value.
use std::ops::Neg; #[derive(Debug, PartialEq)] enum Sign { Negative, Zero, Positive, } impl Neg for Sign { type Output = Self; fn neg(self) -> Self::Output { match self { Sign::Negative => Sign::Positive, Sign::Zero => Sign::Zero, Sign::Positive => Sign::Negative, } } } // A negative positive is a negative. assert_eq!(-Sign::Positive, Sign::Negative); // A double negative is a positive. assert_eq!(-Sign::Negative, Sign::Positive); // Zero is its own negation. assert_eq!(-Sign::Zero, Sign::Zero);
Associated Types
Loading content...Required methods
Loading content...Implementations on Foreign Types
impl Neg for i64
[src]
impl Neg for f64
[src]
impl<'_> Neg for &'_ f64
[src]
impl Neg for i8
[src]
impl<'_> Neg for &'_ i8
[src]
impl<'_> Neg for &'_ isize
[src]
impl<'_> Neg for &'_ i128
[src]
impl<'_> Neg for &'_ i16
[src]
impl<'_> Neg for &'_ i64
[src]
impl Neg for i16
[src]
impl Neg for isize
[src]
impl Neg for i32
[src]
impl Neg for i128
[src]
impl<'_> Neg for &'_ f32
[src]
impl Neg for f32
[src]
impl<'_> Neg for &'_ i32
[src]
impl<'a, T> Neg for &'a Complex<T> where
T: Clone + Num + Neg<Output = T>,
[src]
T: Clone + Num + Neg<Output = T>,
impl<T> Neg for Complex<T> where
T: Clone + Num + Neg<Output = T>,
[src]
Loading content...T: Clone + Num + Neg<Output = T>,
Implementors
impl Neg for TDim
impl Neg for f16
impl Neg for Wrapping<i8>
1.10.0[src]
impl Neg for Wrapping<i16>
1.10.0[src]
impl Neg for Wrapping<i32>
1.10.0[src]
impl Neg for Wrapping<i64>
1.10.0[src]
impl Neg for Wrapping<i128>
1.10.0[src]
impl Neg for Wrapping<isize>
1.10.0[src]
impl Neg for Wrapping<u8>
1.10.0[src]
impl Neg for Wrapping<u16>
1.10.0[src]
impl Neg for Wrapping<u32>
1.10.0[src]
impl Neg for Wrapping<u64>
1.10.0[src]
impl Neg for Wrapping<u128>
1.10.0[src]
impl Neg for Wrapping<usize>
1.10.0[src]
impl<'_> Neg for &'_ Wrapping<i8>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<i16>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<i32>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<i64>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<i128>
1.14.0[src]
type Output = <Wrapping<i128> as Neg>::Output
pub fn neg(self) -> <Wrapping<i128> as Neg>::Output
[src]
impl<'_> Neg for &'_ Wrapping<isize>
1.14.0[src]
type Output = <Wrapping<isize> as Neg>::Output
pub fn neg(self) -> <Wrapping<isize> as Neg>::Output
[src]
impl<'_> Neg for &'_ Wrapping<u8>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<u16>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<u32>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<u64>
1.14.0[src]
impl<'_> Neg for &'_ Wrapping<u128>
1.14.0[src]
type Output = <Wrapping<u128> as Neg>::Output
pub fn neg(self) -> <Wrapping<u128> as Neg>::Output
[src]
impl<'_> Neg for &'_ Wrapping<usize>
1.14.0[src]
type Output = <Wrapping<usize> as Neg>::Output
pub fn neg(self) -> <Wrapping<usize> as Neg>::Output
[src]
impl<'a, A, S, D> Neg for &'a ArrayBase<S, D> where
S: Data<Elem = A>,
D: Dimension,
&'a A: 'a,
&'a A: Neg,
<&'a A as Neg>::Output == A,
[src]
S: Data<Elem = A>,
D: Dimension,
&'a A: 'a,
&'a A: Neg,
<&'a A as Neg>::Output == A,
type Output = ArrayBase<OwnedRepr<A>, D>
pub fn neg(self) -> ArrayBase<OwnedRepr<A>, D>
[src]
Perform an elementwise negation of reference self
and return the
result as a new Array
.
impl<A, S, D> Neg for ArrayBase<S, D> where
S: DataOwned<Elem = A> + DataMut,
A: Clone + Neg<Output = A>,
D: Dimension,
[src]
S: DataOwned<Elem = A> + DataMut,
A: Clone + Neg<Output = A>,
D: Dimension,
type Output = ArrayBase<S, D>
pub fn neg(self) -> ArrayBase<S, D>
[src]
Perform an elementwise negation of self
and return the result.
impl<T> Neg for GenericFactoid<T> where
T: Neg<Output = T> + PartialEq + Clone + Debug + Hash,
[src]
T: Neg<Output = T> + PartialEq + Clone + Debug + Hash,