impl IntoView for `Vec<impl IntoView>

This commit is contained in:
Jose Quesada 2022-12-12 13:52:41 -06:00
parent 582cd7d729
commit ce5355d73f
2 changed files with 13 additions and 21 deletions

View file

@ -568,17 +568,6 @@ impl<El: IntoElement> IntoView for HtmlElement<El> {
}
}
impl<El: IntoElement> IntoView for Vec<HtmlElement<El>> {
#[cfg_attr(
debug_assertions,
instrument(level = "trace", name = "Vec<HtmlElement>", skip_all)
)]
fn into_view(self, cx: Scope) -> View {
Fragment::new(self.into_iter().map(|el| el.into_view(cx)).collect())
.into_view(cx)
}
}
impl<El: IntoElement, const N: usize> IntoView for [HtmlElement<El>; N] {
#[cfg_attr(
debug_assertions,

View file

@ -383,16 +383,6 @@ impl IntoView for View {
}
}
impl IntoView for Vec<View> {
#[cfg_attr(
debug_assertions,
instrument(level = "trace", name = "Vec<Node>", skip_all)
)]
fn into_view(self, cx: Scope) -> View {
Fragment::new(self).into_view(cx)
}
}
impl<const N: usize> IntoView for [View; N] {
#[cfg_attr(
debug_assertions,
@ -745,6 +735,19 @@ impl IntoView for &'static str {
}
}
impl<V> IntoView for Vec<V>
where
V: IntoView,
{
fn into_view(self, cx: Scope) -> View {
self
.into_iter()
.map(|v| v.into_view(cx))
.collect::<Fragment>()
.into_view(cx)
}
}
macro_rules! viewable_primitive {
($child_type:ty) => {
impl IntoView for $child_type {