Skip to main content

typsy/
convert.rs

1use crate::hlist::{Cons, HList, Nil};
2
3include!(concat!(env!("OUT_DIR"), "/convert_tuple.rs"));
4
5pub trait Convert {
6    type HList: HList;
7
8    fn into_hlist(self) -> Self::HList;
9    fn from_hlist(hlist: Self::HList) -> Self;
10}
11
12impl Convert for Nil {
13    type HList = Self;
14
15    fn into_hlist(self) -> Self::HList { Self }
16    fn from_hlist(Nil: Self::HList) -> Self { Self }
17}
18
19impl<T, R: HList> Convert for Cons<T, R> {
20    type HList = Self;
21
22    fn into_hlist(self) -> Self::HList { self }
23    fn from_hlist(this: Self::HList) -> Self { this }
24}