ExtensionConverter

Trait ExtensionConverter 

Source
trait ExtensionConverter: Send + Sync {
    // Required methods
    fn parse_detail(&self, args: &ExtensionArgs) -> Result<Any, ExtensionError>;
    fn textify_detail(
        &self,
        detail: AnyRef<'_>,
    ) -> Result<ExtensionArgs, ExtensionError>;
}
Expand description

Internal trait that converts between ExtensionArgs and protobuf Any messages.

This trait exists because we need to store handlers for different extension types in a single HashMap. Since Rust doesn’t allow trait objects with multiple traits (like Box<dyn AnyConvertible + Explainable>), we need a single trait that combines both operations.

The ExtensionConverter acts as a bridge between:

  • The text format representation (ExtensionArgs) used by the parser/formatter
  • The protobuf Any messages stored in Substrait extension relations

This design allows the registry to work with any type while maintaining type safety through the AnyConvertible and Explainable traits that users implement.

Required Methods§

Implementors§