MCPcopy Create free account
hub / github.com/PerroEngine/Perro / store_scene_doc_cache

Function store_scene_doc_cache

perro_editor/res/scripts/editor/main.rs:58–69  ·  view source on GitHub ↗
(text: &str, doc: &SceneDoc)

Source from the content-addressed store, hash-verified

56 doc
57}
58
59pub fn store_scene_doc_cache(text: &str, doc: &SceneDoc) {
60 let cache = ACTIVE_SCENE_DOC_CACHE.get_or_init(|| Mutex::new(Vec::new()));
61 if let Ok(mut guard) = cache.lock() {
62 if let Some(idx) = guard.iter().position(|cached| cached.text == text) {
63 guard.remove(idx);
64 }
65 guard.push(CachedSceneDoc::new(text.to_string(), Arc::new(doc.clone())));
66 if guard.len() > SCENE_DOC_CACHE_LIMIT {
67 guard.remove(0);
68 }
69 }
70}
71
72impl CachedSceneDoc {

Callers 2

set_state_scene_docFunction · 0.85

Calls 6

cloneMethod · 0.80
positionMethod · 0.45
iterMethod · 0.45
removeMethod · 0.45
pushMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected