26 lines
908 B
Plaintext
26 lines
908 B
Plaintext
#! @file multipliable.sakura
|
|
#! @author John Christman (sorakatadzuma@gmail.com)
|
|
#! @copyright Malunal Studios, LLC.
|
|
#! @license MIT
|
|
#!
|
|
#! Contains the multipliable trait, which asks for the method `*` calls between
|
|
#! two values of one type.
|
|
|
|
module core;
|
|
|
|
|
|
#! A type whose values multiply by another of the type, giving one more.
|
|
#!
|
|
#! `a * b` calls `mul`, and `a *= b` writes what it gives over `a`. A type has
|
|
#! `*` by declaring the method, and may declare others taking other types, as
|
|
#! `vec2::mul(&this, by: &f64)`. The trait is what generic code asks for to
|
|
#! multiply two values of a type, as two matrices. Numbers are multipliable
|
|
#! without declaring anything.
|
|
pub trait multipliable {
|
|
#! Multiplies this value by another, as `*` does.
|
|
#! @param this The value to multiply.
|
|
#! @param other The value to multiply by.
|
|
#! @returns The product.
|
|
def mul(&this, other: &self): self;
|
|
}
|