Trait std::ops::Sub
[−]
[src]
pub trait Sub<RHS = Self> { type Output; fn sub(self, rhs: RHS) -> Self::Output; }
The Sub
trait is used to specify the functionality of -
.
Examples
A trivial implementation of Sub
. When Foo - Foo
happens, it ends up
calling sub
, and therefore, main
prints Subtracting!
.
use std::ops::Sub; struct Foo; impl Sub for Foo { type Output = Foo; fn sub(self, _rhs: Foo) -> Foo { println!("Subtracting!"); self } } fn main() { Foo - Foo; }
Associated Types
type Output
The resulting type after applying the -
operator
Required Methods
Implementors
impl<'a, 'b> Sub for &'b f64
impl<'a> Sub for f64
impl<'a> Sub for &'a f64
impl Sub for f64
impl<'a, 'b> Sub for &'b f32
impl<'a> Sub for f32
impl<'a> Sub for &'a f32
impl Sub for f32
impl<'a, 'b> Sub for &'b i64
impl<'a> Sub for i64
impl<'a> Sub for &'a i64
impl Sub for i64
impl<'a, 'b> Sub for &'b i32
impl<'a> Sub for i32
impl<'a> Sub for &'a i32
impl Sub for i32
impl<'a, 'b> Sub for &'b i16
impl<'a> Sub for i16
impl<'a> Sub for &'a i16
impl Sub for i16
impl<'a, 'b> Sub for &'b i8
impl<'a> Sub for i8
impl<'a> Sub for &'a i8
impl Sub for i8
impl<'a, 'b> Sub for &'b isize
impl<'a> Sub for isize
impl<'a> Sub for &'a isize
impl Sub for isize
impl<'a, 'b> Sub for &'b u64
impl<'a> Sub for u64
impl<'a> Sub for &'a u64
impl Sub for u64
impl<'a, 'b> Sub for &'b u32
impl<'a> Sub for u32
impl<'a> Sub for &'a u32
impl Sub for u32
impl<'a, 'b> Sub for &'b u16
impl<'a> Sub for u16
impl<'a> Sub for &'a u16
impl Sub for u16
impl<'a, 'b> Sub for &'b u8
impl<'a> Sub for u8
impl<'a> Sub for &'a u8
impl Sub for u8
impl<'a, 'b> Sub for &'b usize
impl<'a> Sub for usize
impl<'a> Sub for &'a usize
impl Sub for usize
impl Sub for Wrapping<i64>
impl Sub for Wrapping<i32>
impl Sub for Wrapping<i16>
impl Sub for Wrapping<i8>
impl Sub for Wrapping<isize>
impl Sub for Wrapping<u64>
impl Sub for Wrapping<u32>
impl Sub for Wrapping<u16>
impl Sub for Wrapping<u8>
impl Sub for Wrapping<usize>
impl<'a, 'b, T, S> Sub for &'a HashSet<T, S> where T: Eq + Hash + Clone, S: BuildHasher + Default
impl Sub for Duration
impl Sub for Instant
impl Sub for Instant
impl Sub for SystemTime