drop-bin

Crates.iodrop-bin
lib.rsdrop-bin
version0.2.2
sourcesrc
created_at2020-11-15 17:57:43.280696
updated_at2022-06-03 13:56:23.850058
descriptionDefer running expensive destructors until later
homepage
repositoryhttps://github.com/SabrinaJewson/drop-bin.rs
max_upload_size
id312639
size29,224
Sabrina Jewson (SabrinaJewson)

documentation

README

drop-bin

In Rust, values' destructors are automatically run when they go out of scope. However, destructors can be expensive and so you may wish to defer running them until later, when your program has some free time or memory usage is getting high. A bin allows you to put any number of differently-typed values in it, and you can clear them all out, running their destructors, whenever you want.

Example

let bin = drop_bin::Bin::new();

let some_data = "Hello World!".to_owned();
bin.add(some_data);
// `some_data`'s destructor is not run.

bin.clear();
// `some_data`'s destructor has been run.

License: MIT OR Apache-2.0

Commit count: 14

cargo fmt