1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#![feature(optin_builtin_traits, on_unimplemented, never_type, specialization)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate either;
pub use into_cons::NotTuple;
use into_cons::{ConsOf, IntoCons};
use tuple::{IntoTuple, TupleOf};
#[macro_use]
pub mod cons;
pub mod into_cons;
pub mod tuple;
pub trait Flatten: Sized + IntoCons {
type Flattened;
fn flatten(self) -> Self::Flattened;
}
impl<Tup> Flatten for Tup
where
ConsOf<Self>: IntoTuple<Self>,
{
type Flattened = TupleOf<ConsOf<Self>, Self>;
#[inline(always)]
fn flatten(self) -> Self::Flattened {
self.into_cons().into_tuple()
}
}
pub type Flattened<T> = <T as Flatten>::Flattened;