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{}