-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Inspect io wrappers #5033
Merged
Merged
Inspect io wrappers #5033
Commits on Sep 20, 2022
-
tokio_util: add inspection wrapper for
AsyncRead
There are use cases like checking hashes of files that benefit from being able to inspect bytes read as they come in, while still letting the main code process the bytes as normal (e.g. deserializing into objects, knowing that if there's a hash failure, you'll discard the result). As this is non-trivial to get right (e.g. handling a `buf` that's not empty when passed to `poll_read`, add a wrapper `InspectReader` that gets this right, passing all newly read bytes to a supplied `FnMut` closure. Fixes: tokio-rs#4584
Configuration menu - View commit details
-
Copy full SHA for a0a9051 - Browse repository at this point
Copy the full SHA a0a9051View commit details -
tokio_util: add inspection wrapper for
AsyncWrite
When writing things out, it's useful to be able to inspect the bytes that are being written and do things like hash them as they go past. This isn't trivial to get right, due to partial writes and efficiently handling vectored writes (if used). Provide an `InspectWriter` wrapper that gets this right, giving a supplied `FnMut` closure a chance to inspect the buffers that have been successfully written out. Fixes: tokio-rs#4584
Configuration menu - View commit details
-
Copy full SHA for e9520fe - Browse repository at this point
Copy the full SHA e9520feView commit details
Commits on Sep 27, 2022
-
Configuration menu - View commit details
-
Copy full SHA for ed31c0d - Browse repository at this point
Copy the full SHA ed31c0dView commit details
Commits on Sep 28, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 5b1ae95 - Browse repository at this point
Copy the full SHA 5b1ae95View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd68c48 - Browse repository at this point
Copy the full SHA cd68c48View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d15d7a - Browse repository at this point
Copy the full SHA 9d15d7aView commit details -
use drain instead of a byte-by-byte loop
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Configuration menu - View commit details
-
Copy full SHA for ed89580 - Browse repository at this point
Copy the full SHA ed89580View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e389c7 - Browse repository at this point
Copy the full SHA 6e389c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0739402 - Browse repository at this point
Copy the full SHA 0739402View commit details -
Configuration menu - View commit details
-
Copy full SHA for 542ee97 - Browse repository at this point
Copy the full SHA 542ee97View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.