MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / cached_function_match

Function cached_function_match

plugins/warp/src/cache.rs:40–57  ·  view source on GitHub ↗
(function: &BNFunction, f: F)

Source from the content-addressed store, hash-verified

38}
39
40pub fn cached_function_match<F>(function: &BNFunction, f: F) -> Option<Function>
41where
42 F: Fn() -> Option<Function>,
43{
44 let view = function.view();
45 let view_id = ViewID::from(view.as_ref());
46 let function_id = FunctionID::from(function);
47 let function_cache = MATCHED_FUNCTION_CACHE.get_or_init(Default::default);
48 match function_cache.get(&view_id) {
49 Some(cache) => cache.get_or_insert(&function_id, f).to_owned(),
50 None => {
51 let cache = MatchedFunctionCache::default();
52 let matched = cache.get_or_insert(&function_id, f).to_owned();
53 function_cache.insert(view_id, cache);
54 matched
55 }
56 }
57}
58
59pub fn try_cached_function_match(function: &BNFunction) -> Option<Function> {
60 let view = function.view();

Callers 1

match_functionMethod · 0.85

Calls 6

get_or_insertMethod · 0.80
viewMethod · 0.45
as_refMethod · 0.45
getMethod · 0.45
to_ownedMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected