Skip to main content

TreeGenomeType

Trait TreeGenomeType 

Source
pub trait TreeGenomeType: EvolutionaryGenome {
    type Term: Terminal;
    type Func: Function;

    // Required methods
    fn root(&self) -> &TreeNode<Self::Term, Self::Func>;
    fn root_mut(&mut self) -> &mut TreeNode<Self::Term, Self::Func>;
    fn max_depth(&self) -> usize;
    fn from_root(
        root: TreeNode<Self::Term, Self::Func>,
        max_depth: usize,
    ) -> Self;
}
Expand description

Trait for tree genome types (marker trait for operators)

Required Associated Types§

Source

type Term: Terminal

The terminal type

Source

type Func: Function

The function type

Required Methods§

Source

fn root(&self) -> &TreeNode<Self::Term, Self::Func>

Get the root of the tree

Source

fn root_mut(&mut self) -> &mut TreeNode<Self::Term, Self::Func>

Get a mutable reference to the root

Source

fn max_depth(&self) -> usize

Get the maximum depth

Source

fn from_root(root: TreeNode<Self::Term, Self::Func>, max_depth: usize) -> Self

Create a new tree from a root 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§