Chore: some cleanup and documentation
This commit is contained in:
1 parent
fe6938ceb3
commit
517d7f1495
39 files changed
+507
-2142
No files matched your search
@@ -8,6 +8,10 @@
|
||||
//! - [ ] Children
|
||||
//! - [ ] Keys
|
||||
|
||||
use syn::parse::ParseBuffer;
|
||||
|
||||
use super::AmbiguousElement;
|
||||
|
||||
use {
|
||||
proc_macro::TokenStream,
|
||||
proc_macro2::{Span, TokenStream as TokenStream2},
|
||||
@@ -19,15 +23,44 @@ use {
|
||||
},
|
||||
};
|
||||
|
||||
pub struct Fragment {}
|
||||
pub struct Fragment {
|
||||
children: Vec<AmbiguousElement>,
|
||||
}
|
||||
impl Parse for Fragment {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
todo!()
|
||||
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>()?;
|
||||
|
||||
if content.peek(Token![,]) {
|
||||
let _ = content.parse::<Token![,]>();
|
||||
}
|
||||
}
|
||||
Ok(Self { children })
|
||||
}
|
||||
}
|
||||
|
||||
impl ToTokens for Fragment {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream2) {
|
||||
todo!()
|
||||
let childs = &self.children;
|
||||
let children = quote! {
|
||||
ChildrenList::new(__ctx)
|
||||
#( .add_child(#childs) )*
|
||||
.finish()
|
||||
};
|
||||
tokens.append_all(quote! {
|
||||
// #key_token,
|
||||
dioxus::builder::vfragment(
|
||||
__ctx,
|
||||
None,
|
||||
#children
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user