Trait RefTreeNode

Source
pub trait RefTreeNode {
    // Required methods
    fn get_val(&self) -> Option<i32>;
    fn get_left(&self) -> Option<Rc<RefCell<TreeNode>>>;
    fn get_right(&self) -> Option<Rc<RefCell<TreeNode>>>;
    fn set_val(&mut self, v: i32);
    fn set_sub_nodes(
        &self,
        left: &Option<Rc<RefCell<TreeNode>>>,
        right: &Option<Rc<RefCell<TreeNode>>>,
    );
    fn walk(&self, t: TraversalType, func: fn(Option<Rc<RefCell<TreeNode>>>));
    fn walk_t<T>(
        &self,
        t: TraversalType,
        result: &mut T,
        func: fn(&mut T, Option<Rc<RefCell<TreeNode>>>),
    );
    fn aggregate<T>(
        &self,
        val_func: fn(Option<Rc<RefCell<TreeNode>>>) -> T,
        aggr_func: fn(T, Option<T>, Option<T>) -> Option<T>,
    ) -> Option<T>;
    fn aggregate_t<R, T>(
        &self,
        result: &mut R,
        val_func: fn(&mut R, Option<Rc<RefCell<TreeNode>>>) -> T,
        aggr_func: fn(&mut R, T, Option<T>, Option<T>) -> Option<T>,
    ) -> Option<T>;
}

Required Methods§

Source

fn get_val(&self) -> Option<i32>

Source

fn get_left(&self) -> Option<Rc<RefCell<TreeNode>>>

Source

fn get_right(&self) -> Option<Rc<RefCell<TreeNode>>>

Source

fn set_val(&mut self, v: i32)

Source

fn set_sub_nodes( &self, left: &Option<Rc<RefCell<TreeNode>>>, right: &Option<Rc<RefCell<TreeNode>>>, )

Source

fn walk(&self, t: TraversalType, func: fn(Option<Rc<RefCell<TreeNode>>>))

Source

fn walk_t<T>( &self, t: TraversalType, result: &mut T, func: fn(&mut T, Option<Rc<RefCell<TreeNode>>>), )

Source

fn aggregate<T>( &self, val_func: fn(Option<Rc<RefCell<TreeNode>>>) -> T, aggr_func: fn(T, Option<T>, Option<T>) -> Option<T>, ) -> Option<T>

Source

fn aggregate_t<R, T>( &self, result: &mut R, val_func: fn(&mut R, Option<Rc<RefCell<TreeNode>>>) -> T, aggr_func: fn(&mut R, T, Option<T>, Option<T>) -> Option<T>, ) -> Option<T>

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.

Implementations on Foreign Types§

Source§

impl RefTreeNode for Option<Rc<RefCell<TreeNode>>>

Source§

fn get_val(&self) -> Option<i32>

Source§

fn get_left(&self) -> Option<Rc<RefCell<TreeNode>>>

Source§

fn get_right(&self) -> Option<Rc<RefCell<TreeNode>>>

Source§

fn set_val(&mut self, v: i32)

Source§

fn set_sub_nodes( &self, left: &Option<Rc<RefCell<TreeNode>>>, right: &Option<Rc<RefCell<TreeNode>>>, )

Source§

fn walk(&self, t: TraversalType, func: fn(Option<Rc<RefCell<TreeNode>>>))

Source§

fn walk_t<T>( &self, t: TraversalType, result: &mut T, func: fn(&mut T, Option<Rc<RefCell<TreeNode>>>), )

Source§

fn aggregate<T>( &self, val_func: fn(Option<Rc<RefCell<TreeNode>>>) -> T, aggr_func: fn(T, Option<T>, Option<T>) -> Option<T>, ) -> Option<T>

Source§

fn aggregate_t<R, T>( &self, result: &mut R, val_func: fn(&mut R, Option<Rc<RefCell<TreeNode>>>) -> T, aggr_func: fn(&mut R, T, Option<T>, Option<T>) -> Option<T>, ) -> Option<T>

Implementors§