#[non_exhaustive]pub struct HookCtx<'a> {
pub pool: &'a Pool,
pub tenant: &'a str,
pub user_id: Option<i64>,
}Expand description
What an async hook is told about the request it runs in (#686).
#[non_exhaustive], so a field added later breaks no registered
hook; a caller outside the crate builds one with HookCtx::new.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.pool: &'a PoolThe tenant’s database.
tenant: &'a strThe tenant’s slug. A hook that caches must key on it: the pool is tenant-specific, a process-wide cache is not.
user_id: Option<i64>The signed-in user the hook runs for, if any: an admin user on
admin paths, an admin or a member on public page views (both live
in the tenant’s user table). None for anonymous visitors and the
schedule sweep.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for HookCtx<'a>
impl<'a> !UnwindSafe for HookCtx<'a>
impl<'a> Forget for HookCtx<'a>
impl<'a> Freeze for HookCtx<'a>
impl<'a> Send for HookCtx<'a>
impl<'a> Sync for HookCtx<'a>
impl<'a> Unpin for HookCtx<'a>
impl<'a> UnsafeUnpin for HookCtx<'a>
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.