#shrink #fit #push #shrink-to-fit

shrink-to-fit

Recursively calls shrink_to_fit on all elements of the container

11 releases

0.2.10 Feb 8, 2025
0.2.9 Feb 7, 2025
0.1.0 Feb 6, 2025

#735 in Data structures

Download history 586/week @ 2025-02-03 747/week @ 2025-02-10 764/week @ 2025-02-17 713/week @ 2025-02-24 808/week @ 2025-03-03 623/week @ 2025-03-10 1092/week @ 2025-03-17 677/week @ 2025-03-24 620/week @ 2025-03-31 965/week @ 2025-04-07 651/week @ 2025-04-14 703/week @ 2025-04-21

2,978 downloads per month
Used in 4 crates (3 directly)

Apache-2.0

11KB
236 lines

ddbase

Commons library for Rust by Dudy.


lib.rs:

Shrink-to-fit trait for collections.

This crate provides a ShrinkToFit trait that can be used to shrink-to-fit collections.

Examples

use shrink_to_fit::ShrinkToFit;

let mut vec = Vec::with_capacity(100);
vec.push(1);
vec.push(2);
vec.push(3);
vec.shrink_to_fit();
assert_eq!(vec.len(), 3);
assert_eq!(vec.capacity(), 3);

Dependencies

~0–500KB