Files
sakurac/core/traits/additive.sakura
T

22 lines
852 B
Plaintext
Raw Normal View History

2026-10-26 10:14:11 -05:00
#! @file additive.sakura
#! @author John Christman (sorakatadzuma@gmail.com)
#! @copyright Malunal Studios, LLC.
#! @license MIT
#!
#! Contains the additive trait, which a type implements to add, subtract, and
#! negate its values, and which every number has.
module core;
#! A type whose values add, subtract, and negate, all as one type: lengths of
#! time, vectors, matrices, amounts of money.
#!
#! It composes `addable`, `subtractable`, and `negatable`, which give `+`, `-`,
#! and `-x`, beside `equatable`. It asks for no multiplication, since two
#! lengths of time have no product. Numbers are additive without declaring
#! anything.
#!
#! Within a generic bounded by it, a constant does not stand for a value, as it
#! does under `numeric`: a length of time is no number.
pub trait additive : equatable, addable, subtractable, negatable {}