create fullstack hello world example
This commit is contained in:
1 parent
939e75541e
commit
fdc8ebd1b1
11 files changed
+312
-117
No files matched your search
@@ -6,3 +6,9 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
quote = "1.0.26"
|
||||
server_fn_macro = { version = "0.2.4", features = ["stable"] }
|
||||
syn = { version = "1", features = ["full"] }
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
@@ -1,3 +1,7 @@
|
||||
use proc_macro::TokenStream;
|
||||
use quote::ToTokens;
|
||||
use server_fn_macro::*;
|
||||
|
||||
/// Declares that a function is a [server function](leptos_server). This means that
|
||||
/// its body will only run on the server, i.e., when the `ssr` feature is enabled.
|
||||
///
|
||||
@@ -52,14 +56,14 @@
|
||||
#[proc_macro_attribute]
|
||||
pub fn server(args: proc_macro::TokenStream, s: TokenStream) -> TokenStream {
|
||||
let context = ServerContext {
|
||||
ty: syn::parse_quote!(Scope),
|
||||
path: syn::parse_quote!(::leptos::Scope),
|
||||
ty: syn::parse_quote!(DioxusServerContext),
|
||||
path: syn::parse_quote!(::dioxus_server::prelude::DioxusServerContext),
|
||||
};
|
||||
match server_macro_impl(
|
||||
args.into(),
|
||||
s.into(),
|
||||
Some(context),
|
||||
Some(syn::parse_quote!(::leptos::server_fn)),
|
||||
Some(syn::parse_quote!(::dioxus_server::prelude::server_fn)),
|
||||
) {
|
||||
Err(e) => e.to_compile_error().into(),
|
||||
Ok(s) => s.to_token_stream().into(),
|
||||
|
||||
Reference in new issue
Block a user