Trait std::ops::RemExperimental [-]  [+] [src]

pub trait Rem<RHS, Result> {
    fn rem(self, rhs: RHS) -> Result;
}

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!.

#[deriving(Copy)] struct Foo; impl Rem<Foo, Foo> for Foo { fn rem(self, _rhs: Foo) -> Foo { println!("Remainder-ing!"); self } } fn main() { Foo % Foo; }
#[deriving(Copy)]
struct Foo;

impl Rem<Foo, Foo> for Foo {
    fn rem(self, _rhs: Foo) -> Foo {
        println!("Remainder-ing!");
        self
    }
}

fn main() {
    Foo % Foo;
}

Required Methods

fn rem(self, rhs: RHS) -> Result

The method for the % operator

Implementors