fix: attempt to fix ice

This commit is contained in:
Jonathan Kelley committed 2022-01-03 17:20:22 -05:00
1 parent 616227bd3d
commit 2481cd05c2
2 files changed
+13 -32

No files matched your search

+3 -3
View File
@@ -204,9 +204,9 @@ impl ToTokens for Element {
tokens.append_all(quote! { tokens.append_all(quote! {
__cx.element( __cx.element(
dioxus_elements::#name, dioxus_elements::#name,
[ #(#listeners),* ], __cx.bump().alloc([ #(#listeners),* ]),
[ #(#attr),* ], __cx.bump().alloc([ #(#attr),* ]),
[ #(#children),* ], __cx.bump().alloc([ #(#children),* ]),
#key, #key,
) )
}); });
+10 -29
View File
@@ -447,19 +447,14 @@ impl<'a> NodeFactory<'a> {
})) }))
} }
pub fn element<L, A, V>( pub fn element(
&self, &self,
el: impl DioxusElement, el: impl DioxusElement,
listeners: L, listeners: &'a [Listener<'a>],
attributes: A, attributes: &'a [Attribute<'a>],
children: V, children: &'a [VNode<'a>],
key: Option<Arguments>, key: Option<Arguments>,
) -> VNode<'a> ) -> VNode<'a> {
where
L: 'a + AsRef<[Listener<'a>]>,
A: 'a + AsRef<[Attribute<'a>]>,
V: 'a + AsRef<[VNode<'a>]>,
{
self.raw_element( self.raw_element(
el.tag_name(), el.tag_name(),
el.namespace(), el.namespace(),
@@ -470,29 +465,15 @@ impl<'a> NodeFactory<'a> {
) )
} }
pub fn raw_element<L, A, V>( pub fn raw_element(
&self, &self,
tag_name: &'static str, tag_name: &'static str,
namespace: Option<&'static str>, namespace: Option<&'static str>,
listeners: L, listeners: &'a [Listener<'a>],
attributes: A, attributes: &'a [Attribute<'a>],
children: V, children: &'a [VNode<'a>],
key: Option<Arguments>, key: Option<Arguments>,
) -> VNode<'a> ) -> VNode<'a> {
where
L: 'a + AsRef<[Listener<'a>]>,
A: 'a + AsRef<[Attribute<'a>]>,
V: 'a + AsRef<[VNode<'a>]>,
{
let listeners: &'a L = self.bump.alloc(listeners);
let listeners = listeners.as_ref();
let attributes: &'a A = self.bump.alloc(attributes);
let attributes = attributes.as_ref();
let children: &'a V = self.bump.alloc(children);
let children = children.as_ref();
let key = key.map(|f| self.raw_text(f).0); let key = key.map(|f| self.raw_text(f).0);
VNode::Element(self.bump.alloc(VElement { VNode::Element(self.bump.alloc(VElement {