Trait core::ops::DivExperimental [-]  [+] [src]

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

The Div trait is used to specify the functionality of /.

Example

A trivial implementation of Div. When Foo / Foo happens, it ends up calling div, and therefore, main prints Dividing!.

#[deriving(Copy)] struct Foo; impl Div<Foo, Foo> for Foo { fn div(self, _rhs: Foo) -> Foo { println!("Dividing!"); self } } fn main() { Foo / Foo; }
#[deriving(Copy)]
struct Foo;

impl Div<Foo, Foo> for Foo {
    fn div(self, _rhs: Foo) -> Foo {
        println!("Dividing!");
        self
    }
}

fn main() {
    Foo / Foo;
}

Required Methods

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

The method for the / operator

Implementors