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

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

The Mul trait is used to specify the functionality of *.

Example

A trivial implementation of Mul. When Foo * Foo happens, it ends up calling mul, and therefore, main prints Multiplying!.

#[deriving(Copy)] struct Foo; impl Mul<Foo, Foo> for Foo { fn mul(self, _rhs: Foo) -> Foo { println!("Multiplying!"); self } } fn main() { Foo * Foo; }
#[deriving(Copy)]
struct Foo;

impl Mul<Foo, Foo> for Foo {
    fn mul(self, _rhs: Foo) -> Foo {
        println!("Multiplying!");
        self
    }
}

fn main() {
    Foo * Foo;
}

Required Methods

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

The method for the * operator

Implementors