2013-06-02 02:50:00 +08:00
|
|
|
use std::num::{One, Zero};
|
2013-05-20 03:45:04 +08:00
|
|
|
|
2013-05-21 23:25:01 +08:00
|
|
|
/**
|
|
|
|
* Trait of elements of a ring. A rings is an algebraic structure, the
|
|
|
|
* elements of which have all the common numeric operation but the division:
|
|
|
|
* addition, subtraction, multiplication and distinct elements (`One` and
|
|
|
|
* `Zero`) respectively neutral and absorbant wrt the multiplication.
|
|
|
|
*/
|
2013-05-20 03:45:04 +08:00
|
|
|
pub trait Ring :
|
|
|
|
Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Mul<Self, Self> + One + Zero
|
|
|
|
{ }
|
2013-05-25 21:51:51 +08:00
|
|
|
|
2013-06-10 07:36:47 +08:00
|
|
|
impl<N: Sub<N, N> + Add<N, N> + Neg<N> + Mul<N, N> + One + Zero>
|
|
|
|
Ring for N;
|