Trait core::ops::Rem
[−]
[src]
pub trait Rem<RHS = Self> { type Output = Self; fn rem(self, rhs: RHS) -> Self::Output; }
The Rem
trait is used to specify the functionality of %
.
Examples
A trivial implementation of Rem
. When Foo % Foo
happens, it ends up
calling rem
, and therefore, main
prints Remainder-ing!
.
use std::ops::Rem; #[derive(Copy, Clone)] struct Foo; impl Rem for Foo { type Output = Foo; fn rem(self, _rhs: Foo) -> Foo { println!("Remainder-ing!"); self } } fn main() { Foo % Foo; }
Associated Types
type Output = Self
The resulting type after applying the %
operator
Required Methods
Implementors
impl Rem for usize
impl<'a> Rem<usize> for &'a usize
impl<'a> Rem<&'a usize> for usize
impl<'a, 'b> Rem<&'a usize> for &'b usize
impl Rem for u8
impl<'a> Rem<u8> for &'a u8
impl<'a> Rem<&'a u8> for u8
impl<'a, 'b> Rem<&'a u8> for &'b u8
impl Rem for u16
impl<'a> Rem<u16> for &'a u16
impl<'a> Rem<&'a u16> for u16
impl<'a, 'b> Rem<&'a u16> for &'b u16
impl Rem for u32
impl<'a> Rem<u32> for &'a u32
impl<'a> Rem<&'a u32> for u32
impl<'a, 'b> Rem<&'a u32> for &'b u32
impl Rem for u64
impl<'a> Rem<u64> for &'a u64
impl<'a> Rem<&'a u64> for u64
impl<'a, 'b> Rem<&'a u64> for &'b u64
impl Rem for isize
impl<'a> Rem<isize> for &'a isize
impl<'a> Rem<&'a isize> for isize
impl<'a, 'b> Rem<&'a isize> for &'b isize
impl Rem for i8
impl<'a> Rem<i8> for &'a i8
impl<'a> Rem<&'a i8> for i8
impl<'a, 'b> Rem<&'a i8> for &'b i8
impl Rem for i16
impl<'a> Rem<i16> for &'a i16
impl<'a> Rem<&'a i16> for i16
impl<'a, 'b> Rem<&'a i16> for &'b i16
impl Rem for i32
impl<'a> Rem<i32> for &'a i32
impl<'a> Rem<&'a i32> for i32
impl<'a, 'b> Rem<&'a i32> for &'b i32
impl Rem for i64
impl<'a> Rem<i64> for &'a i64
impl<'a> Rem<&'a i64> for i64
impl<'a, 'b> Rem<&'a i64> for &'b i64
impl Rem for f32
impl<'a> Rem<f32> for &'a f32
impl<'a> Rem<&'a f32> for f32
impl<'a, 'b> Rem<&'a f32> for &'b f32
impl Rem for f64
impl<'a> Rem<f64> for &'a f64
impl<'a> Rem<&'a f64> for f64
impl<'a, 'b> Rem<&'a f64> for &'b f64