pub struct BeforeServePage(pub for<'a> fn(HookCtx<'a>, &'a Page, &'a HeaderMap) -> HookFuture<'a, Option<Response>>);Expand description
Fired in the public router just after resolve_path returns a
page and before the renderer fires. Return Some(Response) to
short-circuit (redirect, 403, custom render, etc.); None to
let the normal renderer handle it.
Multiple hooks register in order; the first one to return
Some(Response) wins.
Tuple Fields§
§0: for<'a> fn(HookCtx<'a>, &'a Page, &'a HeaderMap) -> HookFuture<'a, Option<Response>>Trait Implementations§
Source§impl Clone for BeforeServePage
impl Clone for BeforeServePage
impl Collect for BeforeServePage
impl Copy for BeforeServePage
Auto Trait Implementations§
impl Forget for BeforeServePage
impl Freeze for BeforeServePage
impl RefUnwindSafe for BeforeServePage
impl Send for BeforeServePage
impl Sync for BeforeServePage
impl Unpin for BeforeServePage
impl UnsafeUnpin for BeforeServePage
impl UnwindSafe for BeforeServePage
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.