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

Method get_or_insert

plugins/warp/src/cache.rs:180–192  ·  view source on GitHub ↗
(
        &self,
        function_id: &FunctionID,
        f: F,
    )

Source from the content-addressed store, hash-verified

178
179impl MatchedFunctionCache {
180 pub fn get_or_insert<F>(
181 &self,
182 function_id: &FunctionID,
183 f: F,
184 ) -> Ref<'_, FunctionID, Option<Function>>
185 where
186 F: FnOnce() -> Option<Function>,
187 {
188 self.cache.get(function_id).unwrap_or_else(|| {
189 self.cache.insert(*function_id, f());
190 self.cache.get(function_id).unwrap()
191 })
192 }
193
194 pub fn get(&self, function_id: &FunctionID) -> Option<Ref<'_, FunctionID, Option<Function>>> {
195 self.cache.get(function_id)

Callers 1

cached_function_matchFunction · 0.80

Calls 3

fFunction · 0.85
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected