Crates.io | testdrop |
lib.rs | testdrop |
version | 0.1.2 |
source | src |
created_at | 2016-10-04 21:46:38.464381 |
updated_at | 2017-05-18 11:29:14.404591 |
description | A utility to help test drop implementations |
homepage | https://github.com/malbarbo/testdrop |
repository | https://github.com/malbarbo/testdrop |
max_upload_size | |
id | 6716 |
size | 21,727 |
A small crate to help test drop implementation
Test if the std::rc::Rc
drop implementation works.
extern crate testdrop;
use testdrop::TestDrop;
use std::rc::Rc;
let td = TestDrop::new();
let (id, item) = td.new_item();
let item = Rc::new(item);
let item_clone = item.clone();
// Decrease the reference counter, but do not drop.
drop(item_clone);
td.assert_no_drop(id);
// Decrease the reference counter and then drop.
drop(item);
td.assert_drop(id);
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.