#[non_exhaustive]pub struct EnrichCtx<'a> {
pub pool: &'a Pool,
pub tenant: &'a str,
pub page_id: Option<i64>,
}Expand description
What an enricher is told about the render it is part of.
A struct rather than a bare &Pool so this can gain fields without
breaking every registered enricher — and because the pool alone is
not enough to answer “where am I?”, which is the first thing a block
that inherits something from its page needs to know.
#[non_exhaustive] so a new field breaks no one: a host that
drives the walker builds one with EnrichCtx::new.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
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 this render belongs to, or "" when the caller did
not supply one (the non-_with pre-render, or a host driving
the walker itself).
An enricher that caches must include this in its key. The pool is already tenant-specific, so the query is safe either way — but a process-wide cache keyed on a row id alone will serve one tenant another tenant’s data, and that is not a failure anything downstream can detect.
page_id: Option<i64>The page whose stream this is, when there is one. None for
renders with no page behind them — a preview of unsaved content,
or a host calling the pre-render directly.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for EnrichCtx<'a>
impl<'a> !UnwindSafe for EnrichCtx<'a>
impl<'a> Forget for EnrichCtx<'a>
impl<'a> Freeze for EnrichCtx<'a>
impl<'a> Send for EnrichCtx<'a>
impl<'a> Sync for EnrichCtx<'a>
impl<'a> Unpin for EnrichCtx<'a>
impl<'a> UnsafeUnpin for EnrichCtx<'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
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> ⓘ
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> ⓘ
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 more