temporary-annex

Crates.iotemporary-annex
lib.rstemporary-annex
version0.1.0
sourcesrc
created_at2022-01-11 18:30:05.428868
updated_at2022-01-11 18:30:05.428868
descriptionHelper for creating temporary annex on a collection
homepage
repositoryhttps://github.com/kaleidawave/temporary-annex
max_upload_size
id512390
size5,466
Ben (kaleidawave)

documentation

README

Temporary Annex

Allows pushing to a Vec (or any other type implementing Annexable) with cleanup once result goes out of scope.

e.g.

let mut vec1 = vec![1, 2, 3];
assert_eq!(vec1, [1, 2, 3]);
{
    let new_vec_ref = vec1.push_annex(4);
    assert_eq!(*new_vec_ref, [1, 2, 3, 4]);
}
assert_eq!(vec1, [1, 2, 3]);

This has the effect of a immutable structure but uses the same underlying allocation (no cloning or additional allocations).

Commit count: 2

cargo fmt