Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass through stream_position in ProgressBarIter #309

Merged
merged 1 commit into from Sep 15, 2021
Merged

Pass through stream_position in ProgressBarIter #309

merged 1 commit into from Sep 15, 2021

Conversation

rlee287
Copy link
Contributor

@rlee287 rlee287 commented Sep 11, 2021

This avoids sending a stream_position update and also preserves optimizations that the underlying object may have made for stream_position.

For example, when wrapping a BufReader object, adding this impl allows the use of .stream_position() in functions that take a generic Seek object without causing the performance drop associated with the default impl of stream_position calling seek(SeekFrom::Current(0)) and throwing away the buffer each time.

This avoids sending a stream_position update and also preserves optimizations that the underlying object may have made for stream_position.

For example, when wrapping a `BufReader` object, adding this impl allows the use of `.stream_position()` in functions that take a generic `Seek` object without causing the performance drop associated with the default impl of `stream_position` calling `seek(SeekFrom::Current(0))` and throwing away the buffer each time.
@rlee287 rlee287 changed the title Pass through stream_position in ProgreessBarIter Pass through stream_position in ProgressBarIter Sep 11, 2021
@djc djc merged commit 380c042 into console-rs:main Sep 15, 2021
@djc
Copy link
Collaborator

djc commented Sep 15, 2021

This makes sense, thanks!

@rlee287 rlee287 deleted the patch-1 branch September 15, 2021 15:38
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.

None yet

2 participants