cons_cell 0.1.0

Swiss knife for heterogenous containers
Documentation
use crate::cons::ConsCell;
use crate::cons::traits::distinct::Distinct;
use crate::cons::traits::switches::equal_unordered_switch::EqualUnorderedSwitch;
use typenum::False;

pub trait NotEqualUnordered<C: ConsCell + Distinct>: ConsCell + Distinct {}

impl<CA: ConsCell + Distinct, CB: ConsCell + Distinct> NotEqualUnordered<CB> for CA where
    CA: EqualUnorderedSwitch<CB, Value = False>
{
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::cons::ConsCell;
    use crate::cons::test_types::*;
    use crate::cons::types::hcons::{HCons, HNil};

    fn not_eq_unordered_only<
        CA: ConsCell + Distinct,
        CB: ConsCell + Distinct + NotEqualUnordered<CA>,
    >(
        _: &CA,
    ) {
    }
    #[test]
    fn it_works() {
        let c = HNil::new().extend(U8(1)).extend(U32(2)).extend(U16(3));

        not_eq_unordered_only::<_, HCons<U8, HCons<U64, HCons<U32, HNil>>>>(&c);

        // Does not compile
        //not_eq_unordered_only::<_, HCons<U8, HCons<U16, HCons<U32, HNil>>>>(&c);
    }
}