pub trait AdminPageHandler:
Send
+ Sync
+ 'static {
// Required methods
fn slug(&self) -> &'static str;
fn label(&self) -> &'static str;
fn render<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: AdminPageCtx<'life1>,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn icon(&self) -> Option<&'static str> { ... }
fn section(&self) -> SidebarSection { ... }
fn sort_order(&self) -> i32 { ... }
fn permission_resource(&self) -> Option<&'static str> { ... }
fn permission_actions(&self) -> &'static [Action] { ... }
fn post<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: AdminPageCtx<'life1>,
_form: AdminForm,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Trait every custom admin page implements. Compiled-in via the
inventory registry — see crate::register_admin_page!.
Required Methods§
Sourcefn slug(&self) -> &'static str
fn slug(&self) -> &'static str
URL slug. The page mounts at /cms-admin/x/<slug>. Must
stay stable; bookmarks / links reference this value.
Sourcefn render<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: AdminPageCtx<'life1>,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn render<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: AdminPageCtx<'life1>,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Render the page. The implementation owns its template + form
dispatch (handlers usually render via Tera with the bundled
chrome by extending rcms_admin/_base.html).
Provided Methods§
Sourcefn icon(&self) -> Option<&'static str>
fn icon(&self) -> Option<&'static str>
Optional Material-symbols icon name (e.g. "insights",
"bug_report").
Sourcefn section(&self) -> SidebarSection
fn section(&self) -> SidebarSection
Which sidebar section the entry lives under. Defaults to a
generic Custom("Tools") bucket so out-of-the-box behaviour
keeps third-party pages visually separated from built-ins.
Sourcefn sort_order(&self) -> i32
fn sort_order(&self) -> i32
Sibling order within the section (ascending). Defaults to 100 so most third-party pages slot in between built-ins (which use lower numbers) without needing to think about ordering.
Sourcefn permission_resource(&self) -> Option<&'static str>
fn permission_resource(&self) -> Option<&'static str>
Codename prefix to surface this page in the role permissions
matrix. Returning Some("acme_reports") adds a
“Custom admin pages → <label>” row with view + edit
columns, granting / revoking codenames acme_reports.view
and acme_reports.edit. Default None means the page is
not access-controlled by the matrix — hosts can still gate
inside render() manually.
Sourcefn permission_actions(&self) -> &'static [Action]
fn permission_actions(&self) -> &'static [Action]
The matrix columns for Self::permission_resource, and so the
codenames the dispatcher checks. The default, view + edit, gates
GET on <resource>.view and every POST on <resource>.edit.
Including Action::Add or Action::Delete makes a POST to
the new or delete action need .add or .delete instead.
Sourcefn post<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: AdminPageCtx<'life1>,
_form: AdminForm,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn post<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: AdminPageCtx<'life1>,
_form: AdminForm,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a form posted to /cms-admin/x/<slug> or
/cms-admin/x/<slug>/<action> (see AdminPageCtx::action).
The dispatcher has already checked the login, the CSRF token and
the codename (see Self::permission_actions). The usual reply
is AdminPageCtx::redirect. The default answers
405 Method Not Allowed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".