1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub trait TypeEq {
    type This: ?Sized;
}

impl<T: ?Sized> TypeEq for T {
    type This = Self;
}

/// Convert `Self` into a template, usually some [`Generatable`](crate::generatable::Generatable)
pub trait IntoTemplate<'a> {
    /// The type to convert `Self` into
    type Template;

    /// Convert `Self` into `Self::Template`. The type parameter T is for easy type annotation in
    /// case of ambiguity into which template it should be converted into
    fn into_template<T: TypeEq<This = Self::Template>>(self) -> Self::Template;
}