debug-cell 0.1.0

A clone of the standard library's `RefCell` type with extra debugging support in non-release builds. Whenever a borrow error happens the current locations of where known borrows were created will be printed out as well.

Crate debug_cell [] [src]

A clone of the standard library's RefCell type with extra debugging support in non-release builds.

Whenever a borrow error happens the current locations of where known borrows were created will be printed out as well.

Examples

use debug_cell::RefCell;

let r = RefCell::new(3);
let a = r.borrow();

// In debug builds this will print that the cell is currently borrowed
// above, and in release builds it will behave the same as the standard
// library's `RefCell`
let b = r.borrow_mut();

Structs

Ref

Wraps a borrowed reference to a value in a RefCell box. A wrapper type for an immutably borrowed value from a RefCell<T>.

RefCell

A clone of the standard library's RefCell type.

RefMut

A wrapper type for a mutably borrowed value from a RefCell<T>.

Enums

BorrowState

An enumeration of values returned from the state method on a RefCell<T>.