Expand description
Provides functions to easily integrate Leptos with Viz.
For more details on how to use the integrations, see the
examples
directory in the Leptos repository.
Structs§
- Request
Parts - A struct to hold the parts of the incoming Request. Since
http::Request
isn’t cloneable, we’re forced to construct this for Leptos to use in viz - Response
Options - Allows you to override details of the HTTP response like the status code and add Headers/Cookies.
- Response
Parts - This struct lets you define headers and override the status of the Response from an Element or a Server Function Typically contained inside of a ResponseOptions. Setting this is useful for cookies and custom responses.
Traits§
- Leptos
Routes - This trait allows one to pass a list of routes and a render function to Viz’s router, letting us avoid having to use wildcards or manually define all routes in multiple places.
Functions§
- generate_
request_ parts - Decomposes an HTTP request into its parts, allowing you to read its headers and other data without consuming the body.
- generate_
route_ list - Generates a list of all routes defined in Leptos’s Router in your app. We can then use this to automatically create routes in Viz’s Router without having to use wildcard matching or fallbacks. Takes in your root app Element as an argument so it can walk you app tree. This version is tailored to generate Viz compatible paths.
- generate_
route_ list_ with_ exclusions - Generates a list of all routes defined in Leptos’s Router in your app. We can then use this to automatically create routes in Viz’s Router without having to use wildcard matching or fallbacks. Takes in your root app Element as an argument so it can walk you app tree. This version is tailored to generate Viz compatible paths.
- generate_
route_ list_ with_ exclusions_ and_ ssg - Generates a list of all routes defined in Leptos’s Router in your app. We can then use this to automatically create routes in Viz’s Router without having to use wildcard matching or fallbacks. Takes in your root app Element as an argument so it can walk you app tree. This version is tailored to generate Viz compatible paths.
- generate_
route_ list_ with_ exclusions_ and_ ssg_ and_ context - Generates a list of all routes defined in Leptos’s Router in your app. We can then use this to automatically create routes in Viz’s Router without having to use wildcard matching or fallbacks. Takes in your root app Element as an argument so it can walk you app tree. This version is tailored to generate Viz compatible paths. Additional context will be provided to the app Element.
- generate_
route_ list_ with_ ssg - Generates a list of all routes defined in Leptos’s Router in your app. We can then use this to automatically create routes in Viz’s Router without having to use wildcard matching or fallbacks. Takes in your root app Element as an argument so it can walk you app tree. This version is tailored to generate Viz compatible paths.
- handle_
server_ fns - A Viz handlers to listens for a request with Leptos server function arguments in the body, run the server function if found, and return the resulting Response.
- handle_
server_ fns_ with_ context - A Viz handlers to listens for a request with Leptos server function arguments in the body, run the server function if found, and return the resulting Response.
- redirect
- Provides an easy way to redirect the user from within a server function. Mimicking the Remix
redirect()
, it sets a StatusCode of 302 and a LOCATION header with the provided value. If looking to redirect from the client,leptos_router::use_navigate()
should be used instead - render_
app_ async - Returns a Viz Handler that listens for a
GET
request and tries to route it using leptos_router, asynchronously rendering an HTML page after allasync
Resources have loaded. - render_
app_ async_ with_ context - Returns a Viz Handler that listens for a
GET
request and tries to route it using leptos_router, asynchronously rendering an HTML page after allasync
Resources have loaded. - render_
app_ to_ stream - Returns a Viz Handler that listens for a
GET
request and tries to route it using leptos_router, serving an HTML stream of your application. - render_
app_ to_ stream_ in_ order - Returns a Viz Handler that listens for a
GET
request and tries to route it using leptos_router, serving an HTML stream of your application. This stream will pause at each<Suspense/>
node and wait for it to resolve before sending down its HTML. The app will become interactive once it has fully loaded. - render_
app_ to_ stream_ in_ order_ with_ context - Returns a Viz Handler that listens for a
GET
request and tries to route it using leptos_router, serving an in-order HTML stream of your application. This stream will pause at each<Suspense/>
node and wait for it to resolve before sending down its HTML. The app will become interactive once it has fully loaded. - render_
app_ to_ stream_ with_ context - Returns a Viz Handler that listens for a
GET
request and tries to route it using leptos_router, serving an HTML stream of your application. - render_
app_ to_ stream_ with_ context_ and_ replace_ blocks - Returns a Viz Handler that listens for a
GET
request and tries to route it using leptos_router, serving an HTML stream of your application.