tstr/
make_tstr.rs

1use crate::TStr;
2
3/// For constructing [`TStr`]s or collections of them.
4///
5/// [`TStr`]: ./struct.TStr.html
6pub trait MakeTStr: Copy {
7    /// Gets a value of this type
8    const MAKE: Self;
9}
10
11impl<T> MakeTStr for TStr<T> {
12    const MAKE: Self = TStr::NEW;
13}
14
15macro_rules! tuple_impl {
16    ($($ty:ident)*) => (
17        impl<$($ty),*> MakeTStr for ($($ty,)*)
18        where
19            $($ty: MakeTStr,)*
20        {
21            const MAKE: Self = (
22                $($ty::MAKE,)*
23            );
24        }
25    )
26}
27tuple_impl! {}
28tuple_impl! {A }
29tuple_impl! {A B}
30tuple_impl! {A B C}
31tuple_impl! {A B C D}
32tuple_impl! {A B C D E}
33tuple_impl! {A B C D E F}
34tuple_impl! {A B C D E F G}
35tuple_impl! {A B C D E F G H}