feat: more API updates

This commit is contained in:
Jonathan Kelley committed 2021-12-28 23:20:01 -05:00
1 parent b3ac2ee3f7
commit a4f280d163
17 files changed
+227 -189

No files matched your search

+7 -1
View File
@@ -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
}
+1 -1
View File
@@ -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}"))
/// }
///