pub unsafe fn current(&mut self) -> Option<&mut T> {
        use std::mem::transmute;
        let id = TypeId::of::<T>();
        let ptr: Option<usize> = KEY_CURRENT.with(|current| {
                current.borrow().get(&id).map(|id| *id)
            });
        let ptr = match ptr { None => { return None; } Some(x) => x };
        Some(transmute(ptr as *mut T))
    }
/// Gets mutable reference to current object.
/// Requires mutable reference to prevent access to globals in safe code,
/// and to prevent mutable borrows of same value in scope.
/// Is unsafe because returned reference inherits lifetime from argument.
Gets mutable reference to current object.
Requires mutable reference to prevent access to globals in safe code,
and to prevent mutable borrows of same value in scope.
Is unsafe because returned reference inherits lifetime from argument.
Gets mutable reference to current object . Requires mutable reference to prevent access to globals in safe code and to prevent mutable borrows of same value in scope . Is unsafe because returned reference inherits lifetime from argument .
pub unsafe fn current(&mut self) -> Option<&mut T> {
        use std::mem::transmute;
        let id = TypeId::of::<T>();
        let ptr: Option<usize> = KEY_CURRENT.with(|current| {
                current.borrow().get(&id).map(|id| *id)
            });
        let ptr = match ptr { None => { return None; } Some(x) => x };
        Some(transmute(ptr as *mut T))
    }
pub unsafe fn current ( & mut self ) -> Option < & mut T > { use std :: mem :: transmute ; let id = TypeId :: of :: < T > ( ) ; let ptr : Option < usize > = KEY_CURRENT . with ( | current | { current . borrow ( ) . get ( & id ) . map ( | id | * id ) } ) ; let ptr = match ptr { None => { return None ; } Some ( x ) => x } ; Some ( transmute ( ptr as * mut T ) ) }
Gets mutable reference to current object.
Gets mutable reference to current object .
&mut self
&mut self