slight change to handle internals

master
Avril 4 years ago
parent e5e3d0050c
commit bdde2e873b
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -13,13 +13,36 @@ pub(crate) trait AsHandle<T: GhostHandle>
self.as_handle() as *mut Handle<T> self.as_handle() as *mut Handle<T>
} }
} }
impl<T: GhostHandle> AsHandle<T> for Handle<T> /*impl<T: GhostHandle> AsHandle<T> for Handle<T>
{ {
#[inline] fn as_handle(&mut self) -> &mut Handle<T> #[inline] fn as_handle(&mut self) -> &mut Handle<T>
{ {
self self
} }
}*/ //intentionally leave this unimplemented?
impl<T: GhostHandle> AsHandle<T> for *mut Handle<T>
{
fn as_handle(&mut self) -> &mut Handle<T>
{
unsafe{&mut* *self}
}
#[inline] fn as_raw(&mut self) -> *mut Handle<T>
{
*self
}
}
impl<'a, T: GhostHandle, U> AsHandle<T> for &'a mut U
where U: AsHandle<T>
{
fn as_handle(&mut self) -> &mut Handle<T>
{
(*self).as_handle()
}
#[inline] fn as_raw(&mut self) -> *mut Handle<T>
{
(*self).as_raw()
}
} }
#[cfg(not(nightly))] enum HandleInner{} #[cfg(not(nightly))] enum HandleInner{}

Loading…
Cancel
Save