Trait mz_repr::explain::Explain

source ·
pub trait Explain<'a>: 'a {
    type Context;
    type Text: DisplayText;
    type Json: DisplayJson;
    type Dot: DisplayDot;

    // Provided methods
    fn explain(
        &'a mut self,
        format: &'a ExplainFormat,
        context: &'a Self::Context
    ) -> Result<String, ExplainError> { ... }
    fn explain_text(
        &'a mut self,
        context: &'a Self::Context
    ) -> Result<Self::Text, ExplainError> { ... }
    fn explain_json(
        &'a mut self,
        context: &'a Self::Context
    ) -> Result<Self::Json, ExplainError> { ... }
    fn explain_dot(
        &'a mut self,
        context: &'a Self::Context
    ) -> Result<Self::Dot, ExplainError> { ... }
}
Expand description

A trait that provides a unified interface for objects that can be explained.

All possible subjects of the various forms of an EXPLAIN SQL statement should implement this trait.

Required Associated Types§

source

type Context

The type of the immutable context in which the explanation will be rendered.

source

type Text: DisplayText

The explanation type produced by a successful Explain::explain_text call.

source

type Json: DisplayJson

The explanation type produced by a successful Explain::explain_json call.

source

type Dot: DisplayDot

The explanation type produced by a successful Explain::explain_json call.

Provided Methods§

source

fn explain( &'a mut self, format: &'a ExplainFormat, context: &'a Self::Context ) -> Result<String, ExplainError>

Explain an instance of Self within the given Explain::Context.

Implementors should never have the need to not rely on this default implementation.

Errors

If the given format is not supported, the implementation should return an ExplainError::UnsupportedFormat.

If an ExplainConfig parameter cannot be honored, the implementation should silently ignore this parameter and proceed without returning a Result::Err.

source

fn explain_text( &'a mut self, context: &'a Self::Context ) -> Result<Self::Text, ExplainError>

Construct a Result::Ok of the Explain::Text format from the config and the context.

Errors

If the ExplainFormat::Text is not supported, the implementation should return an ExplainError::UnsupportedFormat.

If an ExplainConfig parameter cannot be honored, the implementation should silently ignore this paramter and proceed without returning a Result::Err.

source

fn explain_json( &'a mut self, context: &'a Self::Context ) -> Result<Self::Json, ExplainError>

Construct a Result::Ok of the Explain::Json format from the config and the context.

Errors

If the ExplainFormat::Text is not supported, the implementation should return an ExplainError::UnsupportedFormat.

If an ExplainConfig parameter cannot be honored, the implementation should silently ignore this paramter and proceed without returning a Result::Err.

source

fn explain_dot( &'a mut self, context: &'a Self::Context ) -> Result<Self::Dot, ExplainError>

Construct a Result::Ok of the Explain::Dot format from the config and the context.

Errors

If the ExplainFormat::Dot is not supported, the implementation should return an ExplainError::UnsupportedFormat.

If an ExplainConfig parameter cannot be honored, the implementation should silently ignore this paramter and proceed without returning a Result::Err.

Implementors§