mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
chore(server_fn_macro): improve docs (#1733)
This commit is contained in:
parent
2b59ae18bc
commit
e706a69139
1 changed files with 4 additions and 4 deletions
|
@ -1,9 +1,10 @@
|
||||||
#![cfg_attr(feature = "nightly", feature(proc_macro_span))]
|
#![cfg_attr(feature = "nightly", feature(proc_macro_span))]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
//! Implementation of the server_fn macro.
|
|
||||||
|
//! Implementation of the `server_fn` macro.
|
||||||
//!
|
//!
|
||||||
//! This crate contains the implementation of the server_fn macro. [server_macro_impl] can be used to implement custom versions of the macro for different frameworks that allow users to pass a custom context from the server to the server function.
|
//! This crate contains the implementation of the `server_fn` macro. [`server_macro_impl`] can be used to implement custom versions of the macro for different frameworks that allow users to pass a custom context from the server to the server function.
|
||||||
|
|
||||||
use proc_macro2::{Literal, Span, TokenStream as TokenStream2};
|
use proc_macro2::{Literal, Span, TokenStream as TokenStream2};
|
||||||
use proc_macro_error::abort;
|
use proc_macro_error::abort;
|
||||||
|
@ -39,7 +40,7 @@ fn fn_arg_is_cx(f: &syn::FnArg, server_context: &ServerContext) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The implementation of the server_fn macro.
|
/// The implementation of the `server_fn` macro.
|
||||||
/// To allow the macro to accept a custom context from the server, pass a custom server context to this function.
|
/// To allow the macro to accept a custom context from the server, pass a custom server context to this function.
|
||||||
/// **The Context comes from the server.** Optionally, the first argument of a server function
|
/// **The Context comes from the server.** Optionally, the first argument of a server function
|
||||||
/// can be a custom context. This context can be used to inject dependencies like the HTTP request
|
/// can be a custom context. This context can be used to inject dependencies like the HTTP request
|
||||||
|
@ -65,7 +66,6 @@ fn fn_arg_is_cx(f: &syn::FnArg, server_context: &ServerContext) -> bool {
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
pub fn server_macro_impl(
|
pub fn server_macro_impl(
|
||||||
args: TokenStream2,
|
args: TokenStream2,
|
||||||
body: TokenStream2,
|
body: TokenStream2,
|
||||||
|
|
Loading…
Reference in a new issue