pub fn new(val: &mut T) -> CurrentGuard<T> {
        let id = TypeId::of::<T>();
        let ptr = val as *mut T as usize;
        let old_ptr = KEY_CURRENT.with(|current| {
            match current.borrow_mut().entry(id) {
                Occupied(mut entry) => Some(entry.insert(ptr)),
                Vacant(entry) => {
                    entry.insert(ptr);
                    None
                }
            }
        });
        CurrentGuard { old_ptr: old_ptr, _val: val }
    }
/// Creates a new current guard.
Creates a new current guard.
Creates a new current guard .
pub fn new(val: &mut T) -> CurrentGuard<T> {
        let id = TypeId::of::<T>();
        let ptr = val as *mut T as usize;
        let old_ptr = KEY_CURRENT.with(|current| {
            match current.borrow_mut().entry(id) {
                Occupied(mut entry) => Some(entry.insert(ptr)),
                Vacant(entry) => {
                    entry.insert(ptr);
                    None
                }
            }
        });
        CurrentGuard { old_ptr: old_ptr, _val: val }
    }
pub fn new ( val : & mut T ) -> CurrentGuard < T > { let id = TypeId :: of :: < T > ( ) ; let ptr = val as * mut T as usize ; let old_ptr = KEY_CURRENT . with ( | current | { match current . borrow_mut ( ) . entry ( id ) { Occupied ( mut entry ) => Some ( entry . insert ( ptr ) ) , Vacant ( entry ) => { entry . insert ( ptr ) ; None } } } ) ; CurrentGuard { old_ptr : old_ptr , _val : val } }
Creates a new current guard.
Creates a new current guard .
val
&mut T
val
&mut T