summaryrefslogtreecommitdiff
path: root/plugins/warp/src/cache
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/warp/src/cache')
-rw-r--r--plugins/warp/src/cache/container.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/warp/src/cache/container.rs b/plugins/warp/src/cache/container.rs
index 59b31bad..0b478ed1 100644
--- a/plugins/warp/src/cache/container.rs
+++ b/plugins/warp/src/cache/container.rs
@@ -15,6 +15,15 @@ pub fn for_cached_containers(f: impl Fn(&dyn Container)) {
}
}
+pub fn for_cached_containers_mut(f: impl Fn(&mut dyn Container)) {
+ let containers_cache = CONTAINER_CACHE.get_or_init(Default::default);
+ for container in containers_cache.iter() {
+ if let Ok(mut guarded_container) = container.write() {
+ f(guarded_container.as_mut());
+ }
+ }
+}
+
// TODO: The static lifetime here is a little wierd... (we need it to Box)
pub fn add_cached_container(container: impl Container + 'static) {
let containers_cache = CONTAINER_CACHE.get_or_init(Default::default);