pub trait ServerFn: ServerFn<()> {
    // Provided method
    fn register_explicit() -> Result<(), ServerFnError> { ... }
}
Expand description

Defines a “server function.” A server function can be called from the server or the client, but the body of its code will only be run on the server, i.e., if a crate feature ssr is enabled.

(This follows the same convention as the Leptos framework’s distinction between ssr for server-side rendering, and csr and hydrate for client-side rendering and hydration, respectively.)

Server functions are created using the server macro.

The function should be registered by calling ServerFn::register(). The set of server functions can be queried on the server for routing purposes by calling server_fn_by_path.

Technically, the trait is implemented on a type that describes the server function’s arguments.

Provided Methods§

source

fn register_explicit() -> Result<(), ServerFnError>

Explicitly registers the server function on platforms that require it, allowing the server to query it by URL.

Explicit server function registration is no longer required on most platforms (including Linux, macOS, iOS, FreeBSD, Android, and Windows)

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> ServerFn for T
where T: ServerFn<()>,