Trait core::ops::MulStable
[-]
[+]
[src]
pub trait Mul<RHS = Self> {
type Output;
fn mul(self, rhs: RHS) -> Output;
}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!.
#![feature(associated_types)] use std::ops::Mul; #[derive(Copy)] struct Foo; impl Mul for Foo { type Output = Foo; fn mul(self, _rhs: Foo) -> Foo { println!("Multiplying!"); self } } fn main() { Foo * Foo; }