pub trait CommandHandler {
// Required method
fn execute(&self, cli: &Cli) -> Result<()>;
// Provided method
fn parse_trees(&self, cli: &Cli) -> Result<(Vec<Tree>, Vec<Tree>)> { ... }
}Expand description
Trait for command handlers - this makes the system extensible
Each command should implement this trait to provide its functionality. The trait receives the full CLI structure, allowing access to global options like the flamegraph file path and any command-specific parameters.
Required Methods§
Provided Methods§
Sourcefn parse_trees(&self, cli: &Cli) -> Result<(Vec<Tree>, Vec<Tree>)>
fn parse_trees(&self, cli: &Cli) -> Result<(Vec<Tree>, Vec<Tree>)>
Parse flamegraph inputs into Tree structures for comparison
§Arguments
cli- The parsed CLI arguments containing flamegraph paths
§Returns
Result<(Vec<Tree>, Vec<Tree>)>- (primary_trees, comparison_trees)- primary_trees: Trees from -f input (1 file = 1 tree, directory = multiple trees)
- comparison_trees: Trees from -c input (empty if no comparison)