pub trait ReduceNode: Clone {
// Required methods
fn node_dtype(&self) -> VortexResult<DType>;
fn scalar_fn(&self) -> Option<&ScalarFnRef>;
fn child(&self, idx: usize) -> Self;
fn child_count(&self) -> usize;
fn new_node(
&self,
scalar_fn: ScalarFnRef,
children: &[Self],
) -> VortexResult<Self>;
}Expand description
A node used for implementing abstract reduction rules over a tree of scalar functions.
Reduction rules are generic over the node type, so a rule is written once and monomorphized
per reducible tree kind: ExpressionReduceNode for expression trees and
ArrayReduceNode for array trees. Nodes borrow from the tree being reduced, making
traversal allocation-free, while nodes produced by ReduceNode::new_node own their
freshly-built subtrees.
Required Methods§
Sourcefn node_dtype(&self) -> VortexResult<DType>
fn node_dtype(&self) -> VortexResult<DType>
Return the data type of this node.
Sourcefn scalar_fn(&self) -> Option<&ScalarFnRef>
fn scalar_fn(&self) -> Option<&ScalarFnRef>
Return this node’s scalar function if it is indeed a scalar fn.
Sourcefn child_count(&self) -> usize
fn child_count(&self) -> usize
Returns the number of children of this node.
Sourcefn new_node(
&self,
scalar_fn: ScalarFnRef,
children: &[Self],
) -> VortexResult<Self>
fn new_node( &self, scalar_fn: ScalarFnRef, children: &[Self], ) -> VortexResult<Self>
Create a new node from the given scalar function and children, inheriting this node’s reduction context (e.g. the expression scope, or the array row count).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".