ach-cell 0.2.4

Atomic Channel
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use ach_cell::Cell;
use on_drop::OnDrop;

#[test]
fn test() {
    let cell = Cell::new();

    let (item, token) = OnDrop::token(1);
    assert!(cell.set(item).is_ok());
    drop(cell.take().unwrap());
    assert!(token.is_droped());

    let (item, token) = OnDrop::token(1);
    assert!(cell.set(item).is_ok());
    drop(cell);
    assert!(token.is_droped());
}