From bdde2e873bfb7c3cd3310f902bceb8d3a0e1b49a Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 10 Sep 2020 15:19:07 +0100 Subject: [PATCH] slight change to handle internals --- src/handle.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/handle.rs b/src/handle.rs index 288fcb4..d85cc70 100644 --- a/src/handle.rs +++ b/src/handle.rs @@ -13,13 +13,36 @@ pub(crate) trait AsHandle self.as_handle() as *mut Handle } } -impl AsHandle for Handle +/*impl AsHandle for Handle { #[inline] fn as_handle(&mut self) -> &mut Handle { self } - +}*/ //intentionally leave this unimplemented? + +impl AsHandle for *mut Handle +{ + fn as_handle(&mut self) -> &mut Handle + { + unsafe{&mut* *self} + } + #[inline] fn as_raw(&mut self) -> *mut Handle + { + *self + } +} +impl<'a, T: GhostHandle, U> AsHandle for &'a mut U +where U: AsHandle +{ + fn as_handle(&mut self) -> &mut Handle + { + (*self).as_handle() + } + #[inline] fn as_raw(&mut self) -> *mut Handle + { + (*self).as_raw() + } } #[cfg(not(nightly))] enum HandleInner{}