Skip to main content

vortex_array/scalar_fn/
display.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4//! The expression-tree interface scalar functions format themselves through.
5
6use std::fmt::Display;
7
8/// Read-only expression-tree interface used by scalar functions for SQL-style formatting.
9///
10/// Both `vortex_expr::Expression` and `vortex_expr::BoundExpression` implement this interface,
11/// allowing scalar functions to format either representation without converting between them.
12pub trait ExprDisplay: Display {
13    /// Return the child at `index`.
14    fn display_child(&self, index: usize) -> &dyn ExprDisplay;
15
16    /// Return the number of children in this node.
17    fn display_children_count(&self) -> usize;
18}