Trait std::ops::RemStable
[-]
[+]
[src]
pub trait Rem<RHS = Self> {
type Output;
fn rem(self, rhs: RHS) -> <Self as Rem<RHS>>::Output;
}The Rem trait is used to specify the functionality of %.
Example
A trivial implementation of Rem. When Foo % Foo happens, it ends up
calling rem, and therefore, main prints Remainder-ing!.
#![feature(associated_types)] use std::ops::Rem; #[derive(Copy)] struct Foo; impl Rem for Foo { type Output = Foo; fn rem(self, _rhs: Foo) -> Foo { println!("Remainder-ing!"); self } } fn main() { Foo % Foo; }