(doc_path: &DocumentPath, original_cache: &mut OriginalDocumentsHash)
| 35 | |
| 36 | fn ensure_orignal_json(doc_path: &DocumentPath, original_cache: &mut OriginalDocumentsHash) -> Result<Rc<Value>, ResolverError> { |
| 37 | use std::collections::hash_map::Entry::*; |
| 38 | match original_cache.entry(doc_path.clone()) { |
| 39 | Occupied(entry) => Ok(entry.get().clone()), |
| 40 | Vacant(entry) => { |
| 41 | let json = doc_path.load_raw()?; |
| 42 | let rc = Rc::new(json); |
| 43 | entry.insert(rc.clone()); |
| 44 | Ok(rc) |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | fn get_resolved_json(doc_path: &DocumentPath, resolved_cache: &mut ResolvedDocumentsHash) -> Option<Rc<Value>> { |
| 50 | resolved_cache.get(doc_path).cloned() |
| 51 | } |
no test coverage detected