#[derive(Copy, Clone)]
pub enum Unencoded {}
#[derive(Copy, Clone)]
pub enum R {}
#[derive(Copy, Clone)]
pub enum RR {}
#[derive(Copy, Clone)]
pub enum RRR {}
#[derive(Copy, Clone)]
pub enum RInverse {}
pub trait Encoding {}
impl Encoding for RRR {}
impl Encoding for RR {}
impl Encoding for R {}
impl Encoding for Unencoded {}
impl Encoding for RInverse {}
pub trait ReductionEncoding {
type Output: Encoding;
}
impl ReductionEncoding for RRR { type Output = RR; }
impl ReductionEncoding for RR { type Output = R; }
impl ReductionEncoding for R { type Output = Unencoded; }
impl ReductionEncoding for Unencoded { type Output = RInverse; }
pub trait ProductEncoding {
type Output: Encoding;
}
impl<E: ReductionEncoding> ProductEncoding for (Unencoded, E) {
type Output = E::Output;
}
impl<E: Encoding> ProductEncoding for (R, E) { type Output = E; }
impl<E: ReductionEncoding> ProductEncoding
for (RInverse, E) where E::Output: ReductionEncoding {
type Output =
<<E as ReductionEncoding>::Output
as ReductionEncoding>::Output;
}
impl ProductEncoding for (RR, RR) {
type Output = RRR;
}
impl ProductEncoding for (RR, Unencoded) {
type Output = <(Unencoded, RR) as ProductEncoding>::Output;
}
impl ProductEncoding for (RR, RInverse) {
type Output = <(RInverse, RR) as ProductEncoding>::Output;
}
impl ProductEncoding for (RRR, RInverse) {
type Output = <(RInverse, RRR) as ProductEncoding>::Output;
}