Offer Cell
A rust library that defines a pattern for providing a reference to stored data, and optionally transferring ownership of that data.
Usage
Initialization
// a cell may be created
let cell = new;
// or initialzed as empty
let empty = empty;
Accessing Data
// access the item as a reference
match cell.item
// access the item as a mutable reference
match cell.item_mut
Offering Data
What sets this apart, is the data within the cell can be "offered"
// if the cell contains an item, it can be offered
let offered = cell.offer ;
// the offered item implements Deref and DerefMut
assert_eq!;
// if nothing else is done with the offered item,
// the data will stay in the cell for later
// alternatively the offering can be consumed
// this leaves nothing in the cell, and takes ownership of the data
let data = offered.take;