Trait core::ops::Neg 1.0.0
[−]
[src]
pub trait Neg {
type Output;
fn neg(self) -> Self::Output;
}The Neg trait is used to specify the functionality of unary -.
Examples
A trivial implementation of Neg. When -Foo happens, it ends up calling
neg, and therefore, main prints Negating!.
use std::ops::Neg; struct Foo; impl Neg for Foo { type Output = Foo; fn neg(self) -> Foo { println!("Negating!"); self } } fn main() { -Foo; }
Associated Types
type Output
The resulting type after applying the - operator
Required Methods
fn neg(self) -> Self::Output
The method for the unary - operator
Implementors
impl Neg for Wrapping<usize>impl Neg for Wrapping<u8>impl Neg for Wrapping<u16>impl Neg for Wrapping<u32>impl Neg for Wrapping<u64>impl Neg for Wrapping<isize>impl Neg for Wrapping<i8>impl Neg for Wrapping<i16>impl Neg for Wrapping<i32>impl Neg for Wrapping<i64>impl Neg for isizeimpl<'a> Neg for &'a isizeimpl Neg for i8impl<'a> Neg for &'a i8impl Neg for i16impl<'a> Neg for &'a i16impl Neg for i32impl<'a> Neg for &'a i32impl Neg for i64impl<'a> Neg for &'a i64impl Neg for f32impl<'a> Neg for &'a f32impl Neg for f64impl<'a> Neg for &'a f64