NodeWithChildren now supports &[C] and Vec<C>.

This commit is contained in:
Filipe Rodrigues 2024-02-16 13:54:35 +00:00
parent e4f0efbbf5
commit b958d581c2
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU

View File

@ -86,7 +86,7 @@ impl Children for () {
}
}
impl<C, const N: usize> Children for [C; N]
impl<C> Children for &'_ [C]
where
C: AsRef<web_sys::Node>,
{
@ -105,6 +105,24 @@ where
}
}
impl<C, const N: usize> Children for [C; N]
where
C: AsRef<web_sys::Node>,
{
fn append_all(self, node: &web_sys::Node) -> Result<(), JsValue> {
self.as_slice().append_all(node)
}
}
impl<C> Children for Vec<C>
where
C: AsRef<web_sys::Node>,
{
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) ),*; )* ) {
$(