larust_http/push_registry_scope.rs
1use axum::extract::Request;
2use axum::middleware::Next;
3use axum::response::Response;
4
5/// Establishes a fresh `larust_view::push_registry` scope around every
6/// request - see that module's own doc comment for what it's for (letting
7/// `@push` content cross a `<wire:...>` mount boundary, or a
8/// `.into_html()`-glued layout, that `@push`/`@stack`'s normal compile-time
9/// resolution can't see across).
10///
11/// Wired in unconditionally by [`crate::Router::into_axum_router`] -
12/// deliberately not an opt-in `.middleware(...)` call the way CSRF is, the
13/// way `with_sessions`'s own session layer isn't either: an app that forgot
14/// to opt in would silently reintroduce the exact "renders as nothing, no
15/// error anywhere" failure this whole mechanism exists to close, for a
16/// feature with no visible symptom until someone actually depends on it.
17pub async fn scope(request: Request, next: Next) -> Response {
18 larust_view::push_registry::with_scope(next.run(request)).await
19}