mz_expr::explain::text

Trait 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 { ... }
    fn seq<'i, T>(
        &self,
        exprs: &'i [T],
        cols: Option<&'i Vec<String>>,
    ) -> impl Iterator<Item = HumanizedExpr<'i, T, Self>> + Clone { ... }
}
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.

Source

fn seq<'i, T>( &self, exprs: &'i [T], cols: Option<&'i Vec<String>>, ) -> impl Iterator<Item = HumanizedExpr<'i, T, Self>> + Clone

Wrap the given exprs (with cols) into HumanizedExpr with the current mode.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§