pub struct Ref<'b, T: 'b + PSafe + ?Sized, A: MemPool> { /* private fields */ }

Implementations

Copies a Ref.

The PRefCell is already immutably borrowed, so this cannot fail. To be able to borrow mutably, all Refs should go out of scope.

This is an associated function that needs to be used as Ref::clone(...). A Clone implementation or a method would interfere with the widespread use of r.borrow().clone() to clone the contents of a PRefCell.

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());

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Crates a new PRefCell and drops the Ref

After calling this function, the Ref won’t be available anymore. It will be possible to borrow the PRefCell mutably. The new PRefCell has a new location with the same data.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.