Trait std::ops::Rem[src]

pub trait Rem<RHS, Result> {
    fn rem<RHS, Result>(&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!.

struct Foo; impl Rem<Foo, Foo> for Foo { fn rem(&self, _rhs: &Foo) -> Foo { println!("Remainder-ing!"); *self } } fn main() { Foo % Foo; }
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<RHS, Result>(&self, rhs: &RHS) -> Result

The method for the % operator

Implementors