find_matching_function

Function find_matching_function 

Source
pub fn find_matching_function<'a, T>(
    query_name: &str,
    available_functions: &'a [MatchableFunction<T>],
) -> Option<(&'a MatchableFunction<T>, MatchConfidence)>
Expand description

Pure function: Find best matching function from a list

Searches through available functions and returns the one with the highest confidence match. Returns None if no match is found.

ยงExamples

use debtmap::risk::function_name_matching::{find_matching_function, MatchableFunction, MatchConfidence};

let functions = vec![
    MatchableFunction { name: "Type::method".to_string(), data: 0.85 },
    MatchableFunction { name: "other_func".to_string(), data: 0.90 },
];

let result = find_matching_function("method", &functions);
assert!(result.is_some());
let (matched, confidence) = result.unwrap();
assert_eq!(matched.data, 0.85);
assert_eq!(confidence, MatchConfidence::Medium);