pub trait Page:
Sized
+ Send
+ Sync
+ 'static {
// Required method
fn render(cx: &Cx) -> impl Future<Output = Result<impl View>> + Send;
// Provided methods
fn slug() -> String { ... }
fn navigation_label() -> String { ... }
fn navigation() -> NavigationItem { ... }
}Expand description
A panel page that is not a resource, mounted at {prefix}/{slug} with a
sidebar entry; the panel owns the route and entry while the page owns its
markup.
struct ReportsPage;
impl Page for ReportsPage {
async fn render(cx: &Cx) -> Result<impl View> {
Ok(view! { cx => tablo_ui::page(tablo_ui::page_title("Reports")) })
}
}
Panel::new("admin").page::<ReportsPage>() // GET /admin/reportsA page serves one GET with a sidebar entry; a form it renders posts to an
app-declared route the auth gate covers.
Required Methods§
Provided Methods§
Sourcefn slug() -> String
fn slug() -> String
The URL segment under the panel prefix. Default: the type name without
a Page suffix, kebab-cased (MediaLibraryPage → media-library).
Panel::home mounts the page at the prefix and
does not read it.
The sidebar label. Default: the type name without a Page suffix, in
sentence case (MediaLibraryPage → Media library).
The sidebar entry; override to set the order or the icon.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".