radicle-term: Optimize impl of VStack::children()

This way the Iterator::size_hint() function can be used by the
Extend::extend() implementation, which might safe reallocations for
the underlying buffer.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2025-08-21 14:03:38 +02:00 committed by Lorenz Leutgeb
parent 93388e366c
commit 19c484e956
1 changed files with 3 additions and 4 deletions

View File

@ -77,10 +77,9 @@ impl<'a> VStack<'a> {
I: IntoIterator<Item = Box<dyn Element>>, I: IntoIterator<Item = Box<dyn Element>>,
{ {
let mut vstack = self; let mut vstack = self;
vstack
for child in children.into_iter() { .rows
vstack = vstack.child(child); .extend(children.into_iter().map(|e| Row::Element(Box::new(e))));
}
vstack vstack
} }