#element #recursion #container #call #shrink #collection-traits

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

#953 in Data structures

Download history 694/week @ 2025-05-21 1155/week @ 2025-05-28 1287/week @ 2025-06-04 816/week @ 2025-06-11 1525/week @ 2025-06-18 1988/week @ 2025-06-25 1514/week @ 2025-07-02 1691/week @ 2025-07-09 3389/week @ 2025-07-16 2798/week @ 2025-07-23 2976/week @ 2025-07-30 3475/week @ 2025-08-06 3620/week @ 2025-08-13 3436/week @ 2025-08-20 2974/week @ 2025-08-27 2800/week @ 2025-09-03

13,698 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–495KB