Research relationship between structure traits and arithmetic operator traits
Research the effects of implementations of Rust arithmetic operator traits (from std::ops
) for the corresponding structure traits. For example, implementing std::ops::Add
trait for types implementing AddMagma
structure trait. This would allow clients of the implementing types to write a + b
, rather than a.add(b)
.
To work within Rust's trait coherence rules this ideally needs to be done within un-algebra
crate. On the other hand, blanket implementations of std::ops::Add
etc may over-constrain implementation choices in downstream crates.
Edited by Stuart Hungerford