detect_default_function

Function detect_default_function 

Source
pub fn detect_default_function(
    crate_dir: &Path,
    crate_name: &str,
) -> Option<String>
Available on crate feature full only.
Expand description

Detects the first benchmark function in a crate by scanning src/lib.rs for #[benchmark]

This function looks for functions marked with the #[benchmark] attribute and returns the first one found in the format {crate_name}::{function_name}.

§Arguments

  • crate_dir - Path to the crate directory containing Cargo.toml
  • crate_name - Name of the crate (used as prefix for the function name)

§Returns

  • Some(String) - The detected function name in format crate_name::function_name
  • None - If no benchmark functions are found or if the file cannot be read