ecsilarant 0.1.0

Sketch of an ECS for the future
Documentation
#![feature(specialization)]

// TODO: Add where I got this from stack overflow.

// Trait to check whether two types are the same.
pub(crate) trait IsEq<T> {}
impl<T> IsEq<T> for T {}

/// Are `T` and `U` are the same type?
pub(crate) const fn type_eq<T: ?Sized, U: ?Sized>() -> bool {
    // Helper trait. `VALUE` is false, except for the specialization of the
    // case where `T == U`.
    trait TypeEq<U: ?Sized> {
        const VALUE: bool;
    }

    // Default implementation.
    impl<T: ?Sized, U: ?Sized> TypeEq<U> for T {
        default const VALUE: bool = false;
    }

    // Specialization for `T == U`.
    impl<T: ?Sized> TypeEq<T> for T {
        const VALUE: bool = true;
    }

    <T as TypeEq<U>>::VALUE
}