wip: remove HTML macro and add custom fields

This commit is contained in:
Jonathan Kelley committed 2021-10-27 16:41:00 -04:00
1 parent a42711a324
commit 9f7eb0f600
9 files changed
+290 -758

No files matched your search

+5 -25
View File
@@ -19,11 +19,11 @@ use {
},
};
pub struct Fragment<const AS: HtmlOrRsx> {
children: Vec<AmbiguousElement<AS>>,
pub struct Fragment {
children: Vec<AmbiguousElement>,
}
impl Parse for Fragment<AS_RSX> {
impl Parse for Fragment {
fn parse(input: ParseStream) -> Result<Self> {
input.parse::<Ident>()?;
@@ -33,7 +33,7 @@ impl Parse for Fragment<AS_RSX> {
let content: ParseBuffer;
syn::braced!(content in input);
while !content.is_empty() {
content.parse::<AmbiguousElement<AS_RSX>>()?;
content.parse::<AmbiguousElement>()?;
if content.peek(Token![,]) {
let _ = content.parse::<Token![,]>();
@@ -43,27 +43,7 @@ impl Parse for Fragment<AS_RSX> {
}
}
impl Parse for Fragment<AS_HTML> {
fn parse(input: ParseStream) -> Result<Self> {
input.parse::<Ident>()?;
let children = Vec::new();
// parse the guts
let content: ParseBuffer;
syn::braced!(content in input);
while !content.is_empty() {
content.parse::<AmbiguousElement<AS_HTML>>()?;
if content.peek(Token![,]) {
let _ = content.parse::<Token![,]>();
}
}
Ok(Self { children })
}
}
impl<const AS: HtmlOrRsx> ToTokens for Fragment<AS> {
impl ToTokens for Fragment {
fn to_tokens(&self, tokens: &mut TokenStream2) {
let childs = &self.children;
let children = quote! {