pub struct ErrorPage;Expand description
The built-in Error page type. Hand-rolled (not #[derive(PageType)]
— the derive emits ::rustango_cms:: paths that don’t resolve from
inside this crate).
Trait Implementations§
Source§impl PageTypeHandler for ErrorPage
impl PageTypeHandler for ErrorPage
Source§fn app_label(&self) -> &'static str
fn app_label(&self) -> &'static str
Logical app this handler belongs to (e.g.
"cms_articles").
Lets multiple crates contribute page types without
type_name collisions, and groups them in the admin.Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Stable identifier — stored in
cms_page_type.type_name. Must
be globally unique across the process.Source§fn verbose_name(&self) -> &'static str
fn verbose_name(&self) -> &'static str
Human-readable label for the admin UI.
Source§fn default_template(&self) -> &'static str
fn default_template(&self) -> &'static str
Default Tera template path the renderer should use. A page can
override it per row via
Page::template_override.Source§fn icon(&self) -> Option<&'static str>
fn icon(&self) -> Option<&'static str>
Material-symbols icon name for the page-type picker tile.
Defaults to
None — picker renders a generic glyph. Authors
set it via #[page_type(icon = "article")] on the
#[derive(PageType)] struct, or by overriding this method on
hand-rolled handlers.Source§fn description(&self) -> Option<&'static str>
fn description(&self) -> Option<&'static str>
One-line description shown under
verbose_name in the
page-type picker. Defaults to None. Authors set it via
#[page_type(description = "…")].Source§fn is_leaf(&self) -> bool
fn is_leaf(&self) -> bool
Whether this type is a leaf — it accepts no child pages at
all. Distinct from
allowed_child_types() == [], which means “no
restriction” (any type may be a child). Returning true is the
first-class way to say “this page can’t have children”
without the sentinel hack of whitelisting a
non-existent child type. Enforced parent-side at create / move
time.Source§fn widgets<'life0, 'life1, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Widget>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn widgets<'life0, 'life1, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Widget>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Rich-widget alternative to
Self::extension_fields.
Returns full crate::Widget instances so handlers can
expose the entire 26-kind widget catalog (Date, DatetimeTz,
Color, Range, Radio, Select, Checkboxes, MultiSelect,
Custom, …) instead of being limited to the legacy six
ExtensionFieldKind variants. Read moreSource§fn load_extension<'life0, 'life1, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Value, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_extension<'life0, 'life1, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Value, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load the typed extension row for a given page id and return
it as JSON for the renderer’s Tera context. Read more
Source§fn save_extension<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
form: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_extension<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
form: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Persist the posted form values into this type’s extension
table. Called by the admin’s page-edit POST handler after the
canonical
cms_page row has been saved. Upsert keyed on
page_id is the standard pattern. Read moreSource§fn allowed_parent_types(&self) -> &'static [&'static str]
fn allowed_parent_types(&self) -> &'static [&'static str]
Page types that are allowed as a parent for instances of this
type. Empty slice = no restriction (the child-side guard).
Source§fn allowed_child_types(&self) -> &'static [&'static str]
fn allowed_child_types(&self) -> &'static [&'static str]
Page types that are allowed as direct children of instances of
this type. Empty slice = no restriction (the parent-side
guard). Symmetric with
Self::allowed_parent_types: both
sides must agree at create / move time.Source§fn is_creatable(&self) -> bool
fn is_creatable(&self) -> bool
Whether this type may be created from the admin “Add page”
menu. Defaults to
true; abstract / programmatically-only
types should override to false.Source§fn feed_kind(&self) -> Option<&'static str>
fn feed_kind(&self) -> Option<&'static str>
Opt this page type in to a public RSS 2.0 / Atom 1.0 feed
(powered by
rustango::syndication). The returned slug is
the URL path segment under /feed/<slug>/rss.xml +
/feed/<slug>/atom.xml; pick something URL-friendly and
distinct from other page types’ slugs. Read moreSource§fn workflow_slug(&self) -> Option<&'static str>
fn workflow_slug(&self) -> Option<&'static str>
Source§fn view_restriction(&self) -> Option<TypeViewRestriction>
fn view_restriction(&self) -> Option<TypeViewRestriction>
Gate every page of this type behind an access requirement — the
per-type analogue of the per-page Privacy tab. Return
None (the default) to leave the type public; return
crate::view_restriction::TypeViewRestriction::login to require
any authenticated member, or
crate::view_restriction::TypeViewRestriction::permission to
require one of a set of permission codenames (checked through the
framework permission engine). Read moreSource§fn view_mode(&self) -> PageViewMode
fn view_mode(&self) -> PageViewMode
Which representation this type serves on its public URL. Read more
Source§fn routes(&self) -> Vec<RouteSpec>
fn routes(&self) -> Vec<RouteSpec>
URL patterns this page type serves IN ADDITION to its
canonical
url_path. Read moreSource§fn route_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page: &'life2 Page,
_matched: &'life3 RouteMatch,
) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn route_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page: &'life2 Page,
_matched: &'life3 RouteMatch,
) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Handler-computed ctx injected when a routable pattern matched.
Mirrors
Self::public_context but receives the matched
route’s name + named capture groups. Override to load
route-specific data — the year’s posts when archive_year
matched, the tagged posts when tag matched, etc. Read moreSource§fn public_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page: &'life2 Page,
) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn public_context<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page: &'life2 Page,
) -> Pin<Box<dyn Future<Output = Result<Map<String, Value>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Inject handler-computed values into the public render’s Tera
context, for hand-rolled
data — e.g. a
HomePage that exposes a latest_posts list
to its template without baking the query into the template
layer. Read moreSource§fn children_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page: &'life2 Page,
) -> Pin<Box<dyn Future<Output = Result<Vec<Page>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn children_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page: &'life2 Page,
) -> Pin<Box<dyn Future<Output = Result<Vec<Page>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Build the
children ctx var the public renderer hands to the
page template (by default the live children, newest first)
— index-style pages (BlogIndexPage, ArchivePage, …) lean on
this to surface only published rows in a meaningful order. Read moreSource§fn extension_fields<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ExtensionField>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extension_fields<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<ExtensionField>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Describe the extension-row’s fields so the admin page-editor
can render a form section for them. The default returns an
empty list — types without an extension table get no extra
inputs in the editor. Read more
Source§fn snippet_m2m_relations(&self) -> Vec<(&'static str, &'static str)>
fn snippet_m2m_relations(&self) -> Vec<(&'static str, &'static str)>
Declared Page↔Snippet many-to-many relations as
(relation_name, snippet_type) pairs. Macro-generated
from the struct-level #[page_type(snippet_m2m(name = "Type", …))]
attribute; the default is none. The public renderer resolves each
relation’s chosen rows into snippet_relations.<name> so templates
can iterate the related snippets.Source§fn preview_extension<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
form: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Value, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn preview_extension<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
pool: &'life1 Pool,
page_id: i64,
form: &'life2 HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Value, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Build a virtual extension
Value from a posted form HashMap
without touching the persisted row. Powers the “preview
unsaved changes” iframe in the page editor — the renderer
substitutes the result for Self::load_extension so the
preview reflects the current form state. Read moreSource§fn extra_tabs<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<TabSpec>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn extra_tabs<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<TabSpec>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn inline_panels(&self) -> Vec<InlinePanelSpec>
fn inline_panels(&self) -> Vec<InlinePanelSpec>
Inline panels — 1-N collections of sub-rows that the page
editor renders as a sortable list of cards. Each
InlinePanelSpec declares the panel’s
stable name, the human label, the per-row fields, and
optional cardinality bounds. Read moreSource§fn load_inline_panel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
_panel_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Map<String, Value>>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn load_inline_panel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
_panel_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Map<String, Value>>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Fetch existing rows for
panel_name keyed under page_id.
Each returned serde_json::Map is one row; keys match the
name of the InlinePanelSpec::fields entries. Read moreSource§fn save_inline_panel<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
_panel_name: &'life2 str,
_rows: &'life3 [Map<String, Value>],
) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn save_inline_panel<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
_panel_name: &'life2 str,
_rows: &'life3 [Map<String, Value>],
) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Persist the posted rows for
panel_name under page_id. The
admin POST handler parses inline-panel form keys
(inline__<panel_name>__<row_idx>__<field>) into row dicts
and calls this with the full set; the handler is responsible
for the upsert / delete-removed semantics. Sort order is the
position in the rows slice. Read moreSource§fn display_fields<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<DisplayField>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn display_fields<'life0, 'life1, 'async_trait>(
&'life0 self,
_pool: &'life1 Pool,
_page_id: i64,
) -> Pin<Box<dyn Future<Output = Result<Vec<DisplayField>, ExecError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Computed / display-only fields shown in an “At a glance”
panel at the top of the page-edit form. Each entry is a
pre-rendered HTML chip (the value is
| safed into the
template) authored by the handler from arbitrary data:
row counts, word counts, derived flags, audit timestamps,
linked-snippet previews, etc. Read moreAuto Trait Implementations§
impl Freeze for ErrorPage
impl RefUnwindSafe for ErrorPage
impl Send for ErrorPage
impl Sync for ErrorPage
impl Unpin for ErrorPage
impl UnsafeUnpin for ErrorPage
impl UnwindSafe for ErrorPage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.