datafusion_common::tree_node

Trait 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>;
}
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>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§