Pass the EventLoopRuntime by value

Now that the EventLoopRuntime simply wraps a &CppEventLoopRuntime,
we can make give the spawned task an owned EventLoopRuntime. This means
that the spawned future can now own and use the EventLoopRuntime within it.
This is safe because as long as the EventLoop exists, so does the
CppEventLoopRuntime.

Change-Id: Iccaa6373fdb9d61a7995758f7b99906275f18c99
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/event_loop_runtime.rs b/aos/events/event_loop_runtime.rs
index 461f650..dfd206e 100644
--- a/aos/events/event_loop_runtime.rs
+++ b/aos/events/event_loop_runtime.rs
@@ -236,7 +236,7 @@
     /// ```
     pub fn new<F>(event_loop: T, fun: F) -> Self
     where
-        F: for<'event_loop> FnOnce(&mut EventLoopRuntime<'event_loop>),
+        F: for<'event_loop> FnOnce(EventLoopRuntime<'event_loop>),
     {
         // SAFETY: The EventLoopRuntime never escapes this function, which means the only code that
         // observes its lifetime is `fun`. `fun` must be generic across any value of its
@@ -253,8 +253,8 @@
         // `EventLoopHolder`s safety requirements prevent anybody else from touching the underlying
         // `aos::EventLoop`.
         let cpp_runtime = unsafe { CppEventLoopRuntime::new(event_loop.into_raw()).within_box() };
-        let mut runtime = unsafe { EventLoopRuntime::new(&cpp_runtime) };
-        fun(&mut runtime);
+        let runtime = unsafe { EventLoopRuntime::new(&cpp_runtime) };
+        fun(runtime);
         Self(ManuallyDrop::new(cpp_runtime), PhantomData)
     }
 }
@@ -271,6 +271,7 @@
     }
 }
 
+#[derive(Copy, Clone)]
 pub struct EventLoopRuntime<'event_loop>(
     &'event_loop CppEventLoopRuntime,
     // See documentation of [`new`] for details.