pub struct BlockRenderCtx<'a> {
pub tera: &'a Tera,
pub dyn_blocks: Option<&'a DynBlockSet>,
}Expand description
Context handed to Block::render + each computed field. Holds
the Tera registry (for nested block_render recursion) and the
trust-bag of pre-rendered child HTML the walker assembles bottom-up.
Sync-only — every render path is sync. Async data (translations, media URLs, snippet HTML) gets pre-fetched in the admin / public request handler before we start the render walk; this struct just carries already-loaded references.
Fields§
§tera: &'a TeraTera instance used for tera.render(template, ctx) calls.
Block templates can recursively call back into Tera via the
registered block_render / stream_render functions.
dyn_blocks: Option<&'a DynBlockSet>Per-request overlay of UI-defined block types (page-builder
dyn blocks). Checked before the inventory registry by every stream
walker. None = code blocks only (the default for all existing
call sites).
Implementations§
Source§impl<'a> BlockRenderCtx<'a>
impl<'a> BlockRenderCtx<'a>
pub fn new(tera: &'a Tera) -> Self
Sourcepub fn with_dyn_blocks(self, set: &'a DynBlockSet) -> Self
pub fn with_dyn_blocks(self, set: &'a DynBlockSet) -> Self
Attach the page-builder dyn-block overlay.
Trait Implementations§
Source§impl<'a> Clone for BlockRenderCtx<'a>
impl<'a> Clone for BlockRenderCtx<'a>
impl<'a> Copy for BlockRenderCtx<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for BlockRenderCtx<'a>
impl<'a> !UnwindSafe for BlockRenderCtx<'a>
impl<'a> Forget for BlockRenderCtx<'a>
impl<'a> Freeze for BlockRenderCtx<'a>
impl<'a> Send for BlockRenderCtx<'a>
impl<'a> Sync for BlockRenderCtx<'a>
impl<'a> Unpin for BlockRenderCtx<'a>
impl<'a> UnsafeUnpin for BlockRenderCtx<'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