We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17ef68a commit 675d341Copy full SHA for 675d341
src/lib.rs
@@ -441,6 +441,14 @@ struct Chan<T> {
441
}
442
443
impl<T> Chan<T> {
444
+ fn shrink_to_fit(&mut self) {
445
+ self.queue.shrink_to_fit();
446
+ self.waiting.shrink_to_fit();
447
+ if let Some((_, ref mut v)) = self.sending {
448
+ v.shrink_to_fit();
449
+ }
450
451
+
452
fn pull_pending(&mut self, pull_extra: bool) {
453
if let Some((cap, sending)) = &mut self.sending {
454
let effective_cap = *cap + pull_extra as usize;
@@ -699,8 +707,7 @@ impl<T> Shared<T> {
699
707
700
708
701
709
fn shrink_to_fit(&self) {
702
- let mut lock = wait_lock(&self.chan);
703
- lock.queue.shrink_to_fit();
710
+ wait_lock(&self.chan).shrink_to_fit();
704
711
705
712
706
713
fn queue_capacity(&self) -> usize {
0 commit comments