Macro alga::impl_quasigroup [] [src]

macro_rules! impl_quasigroup {
    (<$M:ty> for $($T:tt)+) => { ... };
}

Implements the quasigroup trait for types provided.

Examples

#[derive(PartialEq, Clone)]
struct Wrapper<T>(T);

impl<T: AbstractMagma<Additive>> AbstractMagma<Additive> for Wrapper<T> {
    fn operate(&self, right: &Self) -> Self {
        Wrapper(self.0.operate(&right.0))
    }
}

impl<T: Inverse<Additive>> Inverse<Additive> for Wrapper<T> {
    fn inverse(&self) -> Self {
        Wrapper(self.0.inverse())
    }
}

impl_quasigroup!(<Additive> for Wrapper<T> where T: AbstractQuasigroup<Additive>);