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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// pub trait TupleAppend<T> {
// type ResultType;
// fn append(self, t: T) -> Self::ResultType;
// }
// impl<T> TupleAppend<T> for () {
// type ResultType = (T,);
// fn append(self, t: T) -> Self::ResultType {
// (t,)
// }
// }
// macro_rules! impl_tuple_append {
// ( () ) => {};
// ( ( $t0:ident $(, $types:ident)* ) ) => {
// impl<$t0, $($types,)* T> TupleAppend<T> for ($t0, $($types,)*) {
// // Trailing comma, just to be extra sure we are dealing
// // with a tuple and not a parenthesized type/expr.
// type ResultType = ($t0, $($types,)* T,);
// fn append(self, t: T) -> Self::ResultType {
// // Reuse the type identifiers to destructure ourselves:
// let ($t0, $($types,)*) = self;
// // Create a new tuple with the original elements, plus the new one:
// ($t0, $($types,)* t,)
// }
// }
// // Recurse for one smaller size:
// impl_tuple_append! { ($($types),*) }
// };
// }
// impl_tuple_append! {
// // Supports tuples up to size 12:
// (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12)
// }
// #[test]
// fn test_tuple_append() {
// let some_tuple: (i32, &str, bool) = (1, "Hello", true);
// println!("{:?}", some_tuple);
// let n: (u16, u16) = [3, 4].into();
// println!("{:?}", n);
// let with_world: (i32, &str, bool, &str) = some_tuple.append("World");
// println!("{:?}", with_world);
// }
// use http::Uri;
// use impl_trait_for_tuples::impl_for_tuples;
// pub trait Tuple {
// fn simbol_of_to_tuple(self) -> Self;
// }
// #[impl_for_tuples(0, 12)]
// impl Tuple for TupleIdentifier {
// fn simbol_of_to_tuple(self) -> Self {
// self
// }
// }
// use derive_more::{AsRef, Deref, DerefMut, Display, From};
// use urlpattern::{UrlPattern, UrlPatternInit};
// #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Deref, DerefMut, AsRef, Display, From)]
// pub struct Path<T>(T);
// impl<T> Path<T>
// {
// pub fn into_inner(self) -> T {
// self.0
// }
// pub fn new(t: T) -> Path<T> {
// Self(t)
// }
// // pub fn tuple_new(ptn: UrlPattern, uri: Uri) -> Path<T> {
// // }
// }
// // impl Into<Path<()>> for () {
// // fn into(self) -> Path<()> {
// // Path::new(self)
// // }
// // }
// // impl<T> Into<Path<(T,)>> for (T,)
// // where
// // T: Tuple,
// // {
// // fn into(self) -> Path<(T,)> {
// // Path::new(self)
// // }
// // }
// // impl<T, T2> Into<Path<(T, T2)>> for (T, T2)
// // where
// // T: Tuple,
// // T2: Tuple,
// // {
// // fn into(self) -> Path<(T, T2)> {
// // Path::new(self)
// // }
// // }