Crates.io | take-cell-option |
lib.rs | take-cell-option |
version | 0.1.2 |
source | src |
created_at | 2020-02-28 01:34:54.77179 |
updated_at | 2020-02-28 02:12:17.723633 |
description | Utility for taking the value from a cell of a option without cloning. |
homepage | |
repository | https://github.com/Jason5Lee/take-cell-option |
max_upload_size | |
id | 213395 |
size | 14,562 |
Utility for taking the value from a cell of a option without cloning.
Add take-cell-option = "0.1"
to your dependencies.
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());