bo_cell

Crates.iobo_cell
lib.rsbo_cell
version0.1.0
sourcesrc
created_at2019-09-07 05:14:23.172708
updated_at2019-09-07 05:14:23.172708
descriptionA RefCell which borrows its contents rather than owning them
homepage
repositoryhttps://github.com/bradymcd/BoCell-rs.git
max_upload_size
id162915
size10,075
Brady (BradyMcd)

documentation

README

BoCell

This is a simple Rust crate which implements a borrowing Cell variant.

In some cases where the internal mutability and reference properties of a RefCell is required it is advantageous to coerce that Cell from a reference on a temporary basis rather than storing the data as contained in a RefCell and constantly contending with the runtime borrow-checking RefCells employ. BoCell is a RefCell which borrows its contents from a &mut while in scope. This allows for non-overlapping mutable borrows to be taken simultaneously from behind a single &mut.

Features

This is a one track crate. BoCell can be created from a &mut and may be mutably borrowed from once at a time as a RefMut.
RefMut implement both Deref traits and so can be used like any other reference in terms of method calls. RefMut can also be manipulated by it's associated functions RefMut::map() subreferences, RefMut::split_tuple(), and RefMut::split_triple() split the reference into 2 and 3 parts. Be mindful when splitting RefMuts, having two overlapping mutable borrows active at once is undefined behaviour.

Commit count: 0

cargo fmt