take-cell-option

Crates.iotake-cell-option
lib.rstake-cell-option
version0.1.2
sourcesrc
created_at2020-02-28 01:34:54.77179
updated_at2020-02-28 02:12:17.723633
descriptionUtility for taking the value from a cell of a option without cloning.
homepage
repositoryhttps://github.com/Jason5Lee/take-cell-option
max_upload_size
id213395
size14,562
Jason Dongheng Lee (Jason5Lee)

documentation

README

Take Cell Option

Utility for taking the value from a cell of a option without cloning.

Usage

Add take-cell-option = "0.1" to your dependencies.

Example

use take_cell_option::take;
use core::cell::Cell;

let cell = Cell::new(Some(Box::new(10)));
let v = take(&cell);
assert_eq!(*v.unwrap(), 10);
assert!(cell.into_inner().is_none());
Commit count: 0

cargo fmt