Trait mz_expr::explain::HumanizerMode
source · pub trait HumanizerMode: Sized + Clone {
// Required methods
fn new(redacted: bool) -> Self;
fn redacted(&self) -> bool;
fn humanize_ident(col: usize, ident: Ident, f: &mut Formatter<'_>) -> Result;
// Provided methods
fn default() -> Self { ... }
fn expr<'a, T>(
&self,
expr: &'a T,
cols: Option<&'a Vec<String>>,
) -> HumanizedExpr<'a, T, Self> { ... }
fn humanize_datum(&self, datum: Datum<'_>, f: &mut Formatter<'_>) -> Result { ... }
}
Expand description
A trait that abstracts the various ways in which we can humanize expressions.
Currently, the degrees of freedom are:
- Humanizing for an
EXPLAIN
output vs humanizing for a notice output. This is currently handled by the two different implementations of this trait -HumanizedExplain
vsHumanizedNotice
. - Humanizing with redacted or non-redacted literals. This is currently
covered by the
HumanizerMode::redacted
method which is used by the default implementation ofHumanizerMode::humanize_datum
.
Required Methods§
Provided Methods§
sourcefn default() -> Self
fn default() -> Self
Default implementation of a default constructor.
This will produce a HumanizerMode
instance that redacts output in
production deployments, but not in debug builds and in CI.
sourcefn expr<'a, T>(
&self,
expr: &'a T,
cols: Option<&'a Vec<String>>,
) -> HumanizedExpr<'a, T, Self>
fn expr<'a, T>( &self, expr: &'a T, cols: Option<&'a Vec<String>>, ) -> HumanizedExpr<'a, T, Self>
Factory method that wraps the given expr
and cols
into a
HumanizedExpr
with the current mode
.
sourcefn humanize_datum(&self, datum: Datum<'_>, f: &mut Formatter<'_>) -> Result
fn humanize_datum(&self, datum: Datum<'_>, f: &mut Formatter<'_>) -> Result
Render a literal datum.
The default implementation prints a redacted symbol (█) if redaction is enabled.
Object Safety§
This trait is not object safe.