Initial Commit
This commit is contained in:
706 files changed
+135430
No files matched your search
@@ -0,0 +1,25 @@
|
||||
#! @file subtractable.sakura
|
||||
#! @author John Christman (sorakatadzuma@gmail.com)
|
||||
#! @copyright Malunal Studios, LLC.
|
||||
#! @license MIT
|
||||
#!
|
||||
#! Contains the subtractable trait, which asks for the method `-` calls between
|
||||
#! two values of one type.
|
||||
|
||||
module core;
|
||||
|
||||
|
||||
#! A type whose values subtract from another of the type, giving one more.
|
||||
#!
|
||||
#! `a - b` calls `sub`, and `a -= b` writes what it gives over `a`. A type has
|
||||
#! `-` by declaring the method, and may declare others taking or giving other
|
||||
#! types, as `instant::sub(&this, since: &instant): duration`. The trait is
|
||||
#! what generic code asks for to subtract two values of a type. Numbers are
|
||||
#! subtractable without declaring anything.
|
||||
pub trait subtractable {
|
||||
#! Subtracts another value from this one, as `-` does.
|
||||
#! @param this The value to subtract from.
|
||||
#! @param other The value to subtract.
|
||||
#! @returns The difference.
|
||||
def sub(&this, other: &self): self;
|
||||
}
|
||||
Reference in new issue
Block a user