Last active
May 9, 2024 12:39
-
-
Save PoignardAzur/6f9be1178626ab16325c852940afb9db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! impl_into_view_for_tuples { | |
($($ty:ident),* $(,)?) => { | |
impl<$($ty),*> IntoView for ($($ty,)*) | |
where | |
$($ty: IntoView),* | |
{ | |
#[inline] | |
fn into_view(self) -> View { | |
paste::paste! { | |
let ($([<$ty:lower>],)*) = self; | |
[ | |
$([<$ty:lower>].into_view()),* | |
].into_view() | |
} | |
} | |
} | |
}; | |
} | |
// ---- | |
impl<...Ts: IntoView> IntoView for (...Ts) { | |
#[inline] | |
fn into_view(self) -> View { | |
let views = vec![]; | |
for member, T in ...self { | |
views.push::<T>(member.into_view()); | |
} | |
let views_tuple = for member: T in ...self { | |
member.into_view() | |
}; | |
views.into_view() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment