Expand description
Task-local request context for layout-level template data.
Askama can’t reach request state, so flash messages and current user are
carried in a [tokio::task_local!] populated by request_ctx middleware
and read by layout partials via flashes and current_user.
Outside a request scope, accessors return defaults — no task-local setup
needed for direct-render template unit tests.
Structs§
- Current
User - Minimal view of the signed-in user for templates.
Excludes
password_hashso templates can’t read sensitive data viacurrent_user. - Switcher
League - One entry in the overflow menu’s league switcher.
Functions§
- current_
contest - The Current Contest id —
Noneoff-season (hides the Current tab), on non-GET/htmx requests, on the root redirect, and outside a request scope. - current_
team - The signed-in user’s team — the tab bar’s My Team link.
- current_
user - The signed-in user, or None when unauthenticated or outside a request scope.
- flashes
- Drain pending flash messages for this request, plus the implicit league-switch toast when an entity link changed the active league. Returns empty outside a request scope.
- league_
name - The current league’s name — the
<title>suffix. None when signed out, pre-league, or outside a request scope. - league_
switcher - The switcher entries: the user’s team leagues, lowest id first. Empty for users with fewer than two leagues (no switcher shown) and outside a request scope.
- request_
ctx - Build the request context and run the rest of the stack inside the
task-local scope. Must be mounted inside
MessagesManagerLayerand the auth layer so both extensions are populated.