make with_module_exposed_type read-only

This commit is contained in:
Ayaz Hafiz 2022-08-01 09:04:12 -05:00
parent b72c8705e5
commit 4f14c0a8ea
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -51,12 +51,12 @@ impl WorldAbilities {
#[inline(always)]
pub fn with_module_exposed_type<T>(
&mut self,
&self,
module: ModuleId,
mut f: impl FnMut(&mut ExposedTypesStorageSubs) -> T,
mut f: impl FnMut(&ExposedTypesStorageSubs) -> T,
) -> T {
let mut world = self.world.write().unwrap();
let (_, exposed_types) = world.get_mut(&module).expect("module not in the world");
let world = self.world.read().unwrap();
let (_, exposed_types) = world.get(&module).expect("module not in the world");
f(exposed_types)
}