Register a new module in the root namespace. # Panics This function will panic if the internal `RwLock` is poisoned.
(&self, module: ModuleId)
| 123 | /// |
| 124 | /// This function will panic if the internal `RwLock` is poisoned. |
| 125 | pub fn register(&self, module: ModuleId) { |
| 126 | let module = self.modules.index(module); |
| 127 | |
| 128 | if cfg!(debug_assertions) { |
| 129 | assert_eq!(module.parent, ModuleId::ROOT); |
| 130 | } |
| 131 | |
| 132 | let mut root = self.root.write().expect("lock should not be poisoned"); |
| 133 | root.insert(module.name, module.id); |
| 134 | drop(root); |
| 135 | } |
| 136 | |
| 137 | /// Find an item by name in the root namespace. |
| 138 | /// |