Make EventLoopRuntime a thin wrapper over &CppEventLoopRuntime

The idea with this is to (in a future CR), pass EventLoopRuntime
as an owned type instead of a reference. This is important
because we can move the CppEventLoopRuntime as part of the
EventLoopRuntimeHolder. Without that, it's pretty much impossible
to create an event loop task that uses the runtime internally
(e.g. to get the time).

Change-Id: I163d94edba8a57191040fef171bb7abad624f7f8
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/shm_event_loop.rs b/aos/events/shm_event_loop.rs
index bc7cc0a..cd611da 100644
--- a/aos/events/shm_event_loop.rs
+++ b/aos/events/shm_event_loop.rs
@@ -1,6 +1,6 @@
 pub use aos_configuration::{Configuration, ConfigurationExt};
 pub use aos_events_event_loop_runtime::{
-    CppEventLoop, CppExitHandle, EventLoopRuntime, ExitHandle,
+    CppEventLoop, CppEventLoopRuntime, CppExitHandle, EventLoopRuntime, ExitHandle,
 };
 
 use aos_configuration_fbs::aos::Configuration as RustConfiguration;
@@ -172,7 +172,9 @@
         // SAFETY: The runtime and the event loop (i.e. self) both get destroyed at the end of this
         // scope: first the runtime followed by the event loop. The runtime gets exclusive access
         // during initialization in `fun` while the event loop remains unused.
-        let runtime = unsafe { EventLoopRuntime::new(self.inner.as_mut().event_loop_mut()) };
+        let cpp_runtime =
+            unsafe { CppEventLoopRuntime::new(self.inner.as_mut().event_loop_mut()).within_box() };
+        let runtime = unsafe { EventLoopRuntime::new(&cpp_runtime) };
         let mut runtime = Scoped::new(runtime);
         fun(&mut runtime);
         self.run();