Trait datafusion::common::tree_node::ConcreteTreeNode

source ·
pub trait ConcreteTreeNode: Sized {
    // Required methods
    fn children(&self) -> &[Self];
    fn take_children(self) -> (Self, Vec<Self>);
    fn with_new_children(
        self,
        children: Vec<Self>,
    ) -> Result<Self, DataFusionError>;
}
Expand description

Instead of implementing TreeNode, it’s recommended to implement a ConcreteTreeNode for trees that contain nodes with payloads. This approach ensures safe execution of algorithms involving payloads, by enforcing rules for detaching and reattaching child nodes.

Required Methods§

source

fn children(&self) -> &[Self]

Provides read-only access to child nodes.

source

fn take_children(self) -> (Self, Vec<Self>)

Detaches the node from its children, returning the node itself and its detached children.

source

fn with_new_children(self, children: Vec<Self>) -> Result<Self, DataFusionError>

Reattaches updated child nodes to the node, returning the updated node.

Object Safety§

This trait is not object safe.

Implementors§