pub fn module_mut_checked<'a, T: Module>() -> Option<&'a mut T> {
		let current = std::thread::current().id();
		let engine = unsafe { Engine::as_mut() };
		assert_eq!(
			current, engine.main,
			"Engine::module_mut_checked must be called with a LOCAL module on the main thread"
		);
		assert!(T::LOCAL);

		let id = TypeId::of::<T>();
		let module = engine.modules.get_mut(&id)?;
		module.downcast_mut::<T>()
	}
/// Returns a mutable reference to a `Module` if it is marked as LOCAL and is on main thread
Returns a mutable reference to a `Module` if it is marked as LOCAL and is on main thread
Returns a mutable reference to a ` Module ` if it is marked as LOCAL and is on main thread
pub fn module_mut_checked<'a, T: Module>() -> Option<&'a mut T> {
		let current = std::thread::current().id();
		let engine = unsafe { Engine::as_mut() };
		assert_eq!(
			current, engine.main,
			"Engine::module_mut_checked must be called with a LOCAL module on the main thread"
		);
		assert!(T::LOCAL);
		let id = TypeId::of::<T>();
		let module = engine.modules.get_mut(&id)?;
		module.downcast_mut::<T>()
	}
pub fn module_mut_checked < ' a , T : Module > ( ) -> Option < & ' a mut T > { let current = std :: thread :: current ( ) . id ( ) ; let engine = unsafe { Engine :: as_mut ( ) } ; assert_eq ! ( current engine main " " ) ; assert ! ( T LOCAL ) ; let id = TypeId :: of :: < T > ( ) ; let module = engine . modules . get_mut ( & id ) ? ; module . downcast_mut :: < T > ( ) }
Returns a mutable reference to a `Module` if it is marked as LOCAL and is on main thread
Returns a mutable reference to a ` Module ` if it is marked as LOCAL and is on main thread