Loosen event loop runtime safety requirements
Change-Id: If3e735ce3dffb1c0d3bf5271487090ff3e400941
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/simulated_event_loop.rs b/aos/events/simulated_event_loop.rs
index e050893..b453879 100644
--- a/aos/events/simulated_event_loop.rs
+++ b/aos/events/simulated_event_loop.rs
@@ -133,12 +133,11 @@
// SAFETY: The UniquePtr functions we're using here mirror most of the EventLoopHolder requirements
// exactly. Safety requirements on [`SimulatedEventLoopHolder.new`] take care of the rest.
unsafe impl EventLoopHolder for SimulatedEventLoopHolder {
- fn into_raw(self) -> *mut ffi::aos::EventLoop {
- self.0.into_raw()
- }
-
- unsafe fn from_raw(raw: *mut ffi::aos::EventLoop) -> Self {
- Self(UniquePtr::from_raw(raw))
+ fn as_raw(&self) -> *const CppEventLoop {
+ self.0
+ .as_ref()
+ .map(|event_loop| event_loop as *const CppEventLoop)
+ .unwrap_or(core::ptr::null())
}
}