cons_cell 0.1.0

Swiss knife for heterogenous containers
Documentation
use crate::cons::ConsCell;
use crate::cons::traits::switches::contains_switch::ContainsSwitch;
use typenum::False;
use typenum_uuid_trait::TypeId;

pub trait DoesNotContain<T: TypeId>: ConsCell {}

impl<C: ConsCell, T: TypeId> DoesNotContain<T> for C where C: ContainsSwitch<T, Value = False> {}

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

    fn only_does_not_contain<C: ConsCell + DoesNotContain<T>, T: TypeId>(_: C) {}
    #[test]
    fn it_works() {
        let c = HNil::new().extend(U8(1)).extend(U32(2));
        only_does_not_contain::<_, U32>(HNil::new());
        only_does_not_contain::<_, U16>(c);

        // Does not compile
        //only_does_not_contain::<_, U32>(c);
    }
}