pub fn leak(orig: Ref<'b, T, A>) -> &'b T {
        // By forgetting this Ref we ensure that the borrow counter in the RefCell can't go back to
        // UNUSED within the lifetime `'b`. Resetting the reference tracking state would require a
        // unique reference to the borrowed RefCell. No further mutable references can be created
        // from the original cell.
        unsafe {(*orig.value).as_ref()}
    }
/// Convert into a reference to the underlying data.
///
/// The underlying `RefCell` can never be mutably borrowed from again and will always appear
/// already immutably borrowed. It is not a good idea to leak more than a constant number of
/// references. The `RefCell` can be immutably borrowed again if only a smaller number of leaks
/// have occurred in total.
///
/// This is an associated function that needs to be used as
/// `Ref::leak(...)`. A method would interfere with methods of the
/// same name on the contents of a `RefCell` used through `Deref`.
///
/// # Examples
///
/// ```
/// #![feature(cell_leak)]
/// use std::cell::{RefCell, Ref};
/// let cell = RefCell::new(0);
///
/// let value = Ref::leak(cell.borrow());
/// assert_eq!(*value, 0);
///
/// assert!(cell.try_borrow().is_ok());
/// assert!(cell.try_borrow_mut().is_err());
/// ```
Convert into a reference to the underlying data.
The underlying `RefCell` can never be mutably borrowed from again and will always appear
already immutably borrowed. It is not a good idea to leak more than a constant number of
references. The `RefCell` can be immutably borrowed again if only a smaller number of leaks
have occurred in total.

This is an associated function that needs to be used as
`Ref::leak(...)`. A method would interfere with methods of the
same name on the contents of a `RefCell` used through `Deref`.
Convert into a reference to the underlying data . The underlying ` RefCell ` can never be mutably borrowed from again and will always appear already immutably borrowed . It is not a good idea to leak more than a constant number of references . The ` RefCell ` can be immutably borrowed again if only a smaller number of leaks have occurred in total . This is an associated function that needs to be used as ` Ref :: leak ( ... ) ` . A method would interfere with methods of the same name on the contents of a ` RefCell ` used through ` Deref ` .
pub fn leak(orig: Ref<'b, T, A>) -> &'b T {
        // By forgetting this Ref we ensure that the borrow counter in the RefCell can't go back to
        // UNUSED within the lifetime `'b`. Resetting the reference tracking state would require a
        // unique reference to the borrowed RefCell. No further mutable references can be created
        // from the original cell.
        unsafe {(*orig.value).as_ref()}
    }
pub fn leak ( orig : Ref < ' b , T , A > ) -> & ' b T { // By forgetting this Ref we ensure that the borrow counter in the RefCell can't go back to // UNUSED within the lifetime `'b`. Resetting the reference tracking state would require a // unique reference to the borrowed RefCell. No further mutable references can be created // from the original cell. unsafe { ( * orig . value ) . as_ref ( ) } }
Convert into a reference to the underlying data.
Convert into a reference to the underlying data .
orig
Ref<'b, T, A>
examples
None
![feature(cell_leak)]
use std::cell::{RefCell, Ref};
let cell = RefCell::new(0).

let value = Ref::leak(cell.borrow());
assert_eq!(*value, 0).


use std :: cell :: { RefCell Ref } ; let cell = RefCell :: new ( 0 ) . let value = Ref :: leak ( cell . borrow () ) ; assert_eq! ( * value 0 ) .