Fuse the iterator in LazyBuffer#727
Conversation
phimuemue
left a comment
There was a problem hiding this comment.
Hi @Philippe-Cholet! Thanks a lot for your engagement.
Having this as a separate PR simplifies review a lot. Could you shed some light on my question regarding the Powerset::size_hint? I'd merge this if you agree with both.
| /// Returns a reference to the source iterator. | ||
| #[inline] | ||
| pub(crate) fn src(&self) -> &I { &self.pool.it } | ||
| pub(crate) fn src(&self) -> &Fuse<I> { &self.pool.it } |
There was a problem hiding this comment.
This function is only used in Powerset::size_hint, where we ask for src().size_hint - I think that using the size_hint of the fused iterator is actually what we want there. Can you confirm this?
I guess that Powerset::size_hint should - in the future - also redirect to LazyBuffer::size_hint, no? Then we could get rid of this src exposing the innards of LazyBuffer entirely
There was a problem hiding this comment.
Yes entirely, I confirm that Powerset::size_hint wants the not yet written LazyBuffer::size_hint from the wrapped Combinations.
fn src might become fn pool(&self) -> &LazyBuffer<I> later in order for Powerset::size_hint to let src_total = self.combs.pool().size_hint(); instead of doing the job of LazyBuffer::size_hint.
|
Super, thanks. bors r+ |
|
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page.
|
Fuse the iterator in
LazyBuffer.@phimuemue Do I push the new
LazyBuffer::size_hinthere?