pub struct RequestCtx<'a> {
pub req: &'a HttpRequest,
pub params: RouteParams,
pub query: QueryMap,
pub mount: MountPrefix,
pub htmx: HtmxInfo,
pub session: Option<SessionCtx>,
/* private fields */
}Expand description
Unified per-request context passed to Web UI views and handlers.
Fields§
§req: &'a HttpRequest§params: RouteParams§query: QueryMap§mount: MountPrefix§htmx: HtmxInfo§session: Option<SessionCtx>Implementations§
Source§impl<'a> RequestCtx<'a>
impl<'a> RequestCtx<'a>
pub fn new(req: &'a HttpRequest, mount: MountPrefix) -> Self
pub fn with_params(self, params: RouteParams) -> Self
pub fn with_session(self, session: Option<SessionCtx>) -> Self
Sourcepub fn csrf_token(&self) -> Option<&str>
pub fn csrf_token(&self) -> Option<&str>
Return the bound CSRF token if a browser session is active.
Sourcepub fn path(&self, rel: &str) -> String
pub fn path(&self, rel: &str) -> String
Build a mount-aware relative URL (e.g. "/issues" -> "/alpha/issues").
Sourcepub fn url(&self, route: AppRoute<'_>) -> String
pub fn url(&self, route: AppRoute<'_>) -> String
Build a typed route URL via super::route::AppRoute.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for RequestCtx<'a>
impl<'a> Freeze for RequestCtx<'a>where
&'a HttpRequest: Freeze,
*const u8 is !null: Freeze,
PhantomData<(String, String)>: Freeze,
*const LeafNode<String, String> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, String)>>: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<ForgeStore> is !null: Freeze,
PhantomData<ArcInner<ForgeStore>>: Freeze,
impl<'a> Move for RequestCtx<'a>
impl<'a> RefUnwindSafe for RequestCtx<'a>
impl<'a> Send for RequestCtx<'a>
impl<'a> Sync for RequestCtx<'a>
impl<'a> Unpin for RequestCtx<'a>
impl<'a> UnsafeUnpin for RequestCtx<'a>where
&'a HttpRequest: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<ForgeStore> is !null: UnsafeUnpin,
PhantomData<ArcInner<ForgeStore>>: UnsafeUnpin,
impl<'a> UnwindSafe for RequestCtx<'a>where
&'a HttpRequest: UnwindSafe,
RawVecInner: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
Arc<ForgeStore>: UnwindSafe,
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