From b958d581c2fb1068f37ef2d78582c2a0fe80ab02 Mon Sep 17 00:00:00 2001 From: Filipe Rodrigues Date: Fri, 16 Feb 2024 13:54:35 +0000 Subject: [PATCH] `NodeWithChildren` now supports `&[C]` and `Vec`. --- dynatos-html/src/lib.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dynatos-html/src/lib.rs b/dynatos-html/src/lib.rs index 4d42c31..845fb35 100644 --- a/dynatos-html/src/lib.rs +++ b/dynatos-html/src/lib.rs @@ -86,7 +86,7 @@ impl Children for () { } } -impl Children for [C; N] +impl Children for &'_ [C] where C: AsRef, { @@ -105,6 +105,24 @@ where } } +impl Children for [C; N] +where + C: AsRef, +{ + fn append_all(self, node: &web_sys::Node) -> Result<(), JsValue> { + self.as_slice().append_all(node) + } +} + +impl Children for Vec +where + C: AsRef, +{ + fn append_all(self, node: &web_sys::Node) -> Result<(), JsValue> { + self.as_slice().append_all(node) + } +} + /// Implements `Children` on tuples macro impl_children_tuple( $( $( $C:ident($idx:tt) ),*; )* ) { $(