pub trait RenderExt: Render {
// Required method
fn displayed<'a>(&'a self, ctx: &'a RenderCtx<'a>) -> Displayed<'a, Self>
where Self: Sized;
// Provided method
fn debug_sql<'a>(&'a self, resolver: &'a dyn Resolver) -> DebugSql<'a, Self>
where Self: Sized { ... }
}Expand description
Required Methods§
Provided Methods§
Sourcefn debug_sql<'a>(&'a self, resolver: &'a dyn Resolver) -> DebugSql<'a, Self>where
Self: Sized,
fn debug_sql<'a>(&'a self, resolver: &'a dyn Resolver) -> DebugSql<'a, Self>where
Self: Sized,
Render this node for debugging against an explicitly-supplied resolver
(the debug-SQL mitigation), returning a Display adapter.
Reach for this only for a detached or synthesized node — one not behind a
Parsed root and possibly holding symbols the resolver on hand does not
own. Prefer the canonical path first: the Parsed root’s Display and
displayed render exact SQL because they travel with the
matched source and resolver, and cannot mismatch.
This helper trades exactness for safety on a detached node:
- The
resolveris an explicit argument — never a hidden thread-local, global, or default — so it can never silently render with the wrong resolver: the choice is always written at the call site. - A symbol the
resolverdoes not know renders as<unresolved>rather than panicking, so a partially-detached tree still prints to completion. - Literals use their kind-based spelling (
0,'',NULL, …): debug rendering never slices source, so it cannot emit unrelated bytes.
Limitation. An explicit argument cannot detect a resolver from a different parse: a symbol whose numeric id happens to collide with an entry in that resolver resolves to the other parse’s text. The helper prevents a silent choice of the wrong resolver and turns unknown symbols into a visible placeholder, but only the canonical path — which owns its own matched resolver — rules a colliding foreign resolver out entirely.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".