(
&self,
function_id: &FunctionID,
f: F,
)
| 178 | |
| 179 | impl 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) |
no test coverage detected