pass on: to components (and lay basis for passing all other attributes)

This commit is contained in:
Greg Johnston
2024-02-23 15:59:42 -05:00
parent 53703f208a
commit 9e276a8879
21 changed files with 644 additions and 435 deletions

View File

@@ -1,10 +1,10 @@
#![no_std]
#![allow(non_snake_case)]
pub trait TupleBuilder<Next> {
type Output;
pub trait TupleBuilder {
type Output<Next>;
fn next_tuple(self, next: Next) -> Self::Output;
fn next_tuple<Next>(self, next: Next) -> Self::Output<Next>;
}
pub trait ConcatTuples<Next> {
@@ -14,11 +14,11 @@ pub trait ConcatTuples<Next> {
}
macro_rules! impl_tuple_builder {
($($ty:ident),* => $last:ident) => {
impl<$($ty),*, $last> TupleBuilder<$last> for ($($ty,)*) {
type Output = ($($ty,)* $last);
($($ty:ident),*) => {
impl<$($ty),*> TupleBuilder for ($($ty,)*) {
type Output<Next> = ($($ty,)* Next);
fn next_tuple(self, next: $last) -> Self::Output {
fn next_tuple<Next>(self, next: Next) -> Self::Output<Next> {
let ($($ty,)*) = self;
($($ty,)* next)
}
@@ -26,51 +26,50 @@ macro_rules! impl_tuple_builder {
};
}
impl<A> TupleBuilder<A> for () {
type Output = (A,);
impl TupleBuilder for () {
type Output<Next> = (Next,);
fn next_tuple(self, next: A) -> Self::Output {
fn next_tuple<Next>(self, next: Next) -> Self::Output<Next> {
(next,)
}
}
impl_tuple_builder!(A => B);
impl_tuple_builder!(A, B => C);
impl_tuple_builder!(A, B, C => D);
impl_tuple_builder!(A, B, C, D => E);
impl_tuple_builder!(A, B, C, D, E => F);
impl_tuple_builder!(A, B, C, D, E, F => G);
impl_tuple_builder!(A, B, C, D, E, F, G => H);
impl_tuple_builder!(A, B, C, D, E, F, G, H => I);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I => J);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J => K);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K => L);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L => M);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M => N);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N => O);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O => P);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P => Q);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q => R);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R => S);
impl_tuple_builder!(A);
impl_tuple_builder!(A, B);
impl_tuple_builder!(A, B, C);
impl_tuple_builder!(A, B, C, D);
impl_tuple_builder!(A, B, C, D, E);
impl_tuple_builder!(A, B, C, D, E, F);
impl_tuple_builder!(A, B, C, D, E, F, G);
impl_tuple_builder!(A, B, C, D, E, F, G, H);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S);
impl_tuple_builder!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T);
impl_tuple_builder!(
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S => T
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U
);
impl_tuple_builder!(
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T => U
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V
);
impl_tuple_builder!(
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U => V
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W
);
impl_tuple_builder!(
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V => W
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X
);
impl_tuple_builder!(
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W => X
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y
);
impl_tuple_builder!(
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X => Y
);
impl_tuple_builder!(
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y =>
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y,
Z
);