pub trait RouterBuilderPanelExt: Sized {
// Required method
fn panel(&mut self, panel: Panel) -> Result<PanelHandle>;
}Expand description
Mounts a Panel on a router the app owns.
let mut builder = Router::builder().discover().with(db);
let admin = builder.panel(Panel::new("admin").resource::<UserResource>())?;
let portal =
builder.panel(Panel::new("portal").auth(Auth::custom(Members)).resource::<OrderResource>())?;
let router = builder.build();
assert!(admin.id() == "admin" && portal.id() == "/portal");Required Methods§
Sourcefn panel(&mut self, panel: Panel) -> Result<PanelHandle>
fn panel(&mut self, panel: Panel) -> Result<PanelHandle>
Mounts panel at its prefix with its routes, shell layout, and gating layers, and returns
its PanelHandle: what a job, a test or a public page keeps to reach the mounted panel,
and whose id is the one
PanelUser::can_access_panel receives.
The panel reads the router’s Db and asset bundle, so .with(db) and
.assets(..) come first. The first panel mounted also installs what every panel shares:
cookies, the gate over Topcoat’s runtime endpoints, and Topcoat’s runtime layer with link
prefetching off unless the router already set those up. A panel keeps its sessions in its
own cookie, so the app’s Topcoat sessions, if any, stay the app’s. The runtime layer has no
path, so mount panels after the app’s own pathless layers: a page re-run must reach
those layers already rewritten to a GET.
§Errors
A MountError listing every declaration mistake, each a
DeclarationErrorKind. A refused panel leaves the builder
empty: build no router from it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".