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:

Required Methods§

source

fn new(redacted: bool) -> Self

Create a new instance of the optimizer mode with literal redaction determined by the redacted parameter value.

source

fn redacted(&self) -> bool

Return true iff literal redaction is enabled for this mode.

source

fn humanize_ident(col: usize, ident: Ident, f: &mut Formatter<'_>) -> Result

Render reference to column col which resolves to the given ident.

Provided Methods§

source

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.

source

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.

source

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.

Implementors§