Skip to content

Make Consumer and Producer dyn-compatible#53

Open
mincomk wants to merge 1 commit intoagerasev:masterfrom
mincomk:master
Open

Make Consumer and Producer dyn-compatible#53
mincomk wants to merge 1 commit intoagerasev:masterfrom
mincomk:master

Conversation

@mincomk
Copy link
Copy Markdown

@mincomk mincomk commented Jan 6, 2026

Make Consumer and Producer dyn-compatible

I've made the two main traits in the crate: Consumer and Producer dyn-compatible by making iter-related methods explicitly non-dispatchable.

There may be a performance issue caused by manual push_iter in Producer, but it would be minor.

@agerasev agerasev force-pushed the master branch 2 times, most recently from ce05351 to ff8b4c9 Compare May 3, 2026 07:48
Comment thread src/traits/producer.rs
Comment on lines +194 to +205
fn push_iter<I: Iterator<Item = Self::Item>>(&mut self, iter: I) -> usize
where
Self: Sized,
{
let mut count = 0;
for item in iter {
if self.try_push(item).is_err() {
break;
}
count += 1;
}
count
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks push_iter implementation because next item still removed from iterator even if there's no free space in the buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants