Crate gpui_router

Crate gpui_router 

Source
Expand description

A router for GPUI applications, providing declarative routing capabilities.

Structs§

Location
A Location represents a URL-like location in the router. It contains a pathname and an optional state object.
NavLink
A navigation link that changes the route when clicked.
Outlet
A placeholder element for routed components. When no component is routed to this outlet, it renders as an empty element.
PathMatch
A PathMatch contains info about how a PathPattern matched on a URL-like pathname.
Route
Configures an element to render when a pattern matches the current path. It must be rendered within a Routes element.
Router
A simple router component that can hold child elements.
RouterState
The global state of the router, including the current location, path match, and parameters. This state is stored globally within the GPUI application context.
Routes
Renders a branch of Route that best matches the current path.

Traits§

Layout
A layout that can wrap around routed elements. Used by Router to render layouts around matched routes.

Functions§

init
Initializes the router system within a GPUI application context.
nav_link
A navigation link that changes the route when clicked.
outlet
An outlet is a placeholder in the UI where routed components will be rendered.
route
Creates a new Route element.
router
A simple router component that can hold child elements.
use_location
Returns the current Location. This can be useful if you’d like to perform some side effect whenever it changes.
use_navigate
Returns a function that lets you navigate programmatically in response to user interactions or effects.
use_params
Returns the current route parameters as a map of key-value pairs. This is useful for accessing dynamic segments in the route path. For example, if you have a route defined as /user/{id}, you can access the id parameter using this hook.

Derive Macros§

IntoLayout
#[derive(IntoLayout)] is used to create a Layout with outlet.