feat: more API updates
This commit is contained in:
1 parent
b3ac2ee3f7
commit
a4f280d163
17 files changed
+227
-189
No files matched your search
@@ -92,13 +92,19 @@ impl ToTokens for InlinePropsBody {
|
||||
quote! { #[derive(Props)] }
|
||||
};
|
||||
|
||||
let lifetime = if generics.params.is_empty() {
|
||||
quote! {}
|
||||
} else {
|
||||
quote! { 'a, }
|
||||
};
|
||||
|
||||
out_tokens.append_all(quote! {
|
||||
#modifiers
|
||||
#vis struct #struct_name #generics {
|
||||
#(#fields),*
|
||||
}
|
||||
|
||||
#vis fn #ident #generics (#cx_token: Scope<'a, #struct_name #generics>) #output {
|
||||
#vis fn #ident #generics (#cx_token: Scope<#lifetime #struct_name #generics>) #output {
|
||||
let #struct_name { #(#field_names),* } = &cx.props;
|
||||
#block
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ pub fn routable_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStrea
|
||||
/// # Example
|
||||
/// ```
|
||||
/// #[inline_props]
|
||||
/// fn app(cx: Scope<{ bob: String }>) -> Element {
|
||||
/// fn app(cx: Scope, bob: String) -> Element {
|
||||
/// cx.render(rsx!("hello, {bob}"))
|
||||
/// }
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user