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

Prevent double buffering by exposing the BufRead bound #100

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

sftse
Copy link
Contributor

@sftse sftse commented Feb 7, 2025

This is a bit of a nit, but interfaces that expose Read bounds should not do internal buffering, as this risks the caller accidentally passing a type that is already buffered, resulting in double buffering. Instead, by exposing the BufRead bound the caller is forced to buffer if he tries passing a type that only implements Read. Since the caller has better awareness of the code he is writing, he is much less likely to accidentally buffer a reader twice.

@mdecimus mdecimus merged commit 209778f into stalwartlabs:main Feb 9, 2025
1 check passed
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