Simplify the interface around request buffer#262
Merged
ubnt-intrepid merged 1 commit intomainfrom Dec 11, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies the request buffer interface by consolidating the previously separate buffer types (SpliceBuf and FallbackBuf) into a unified RequestBuf type. The refactoring addresses issue #261 by removing generic trait-based abstractions and replacing them with a concrete implementation that internally handles both pipe-based (splice) and vector-based buffer strategies.
- Unified buffer types:
SpliceBufandFallbackBufare now internal variants ofRequestBuf - Simplified API: Removed
TryReceiveandToPartstraits in favor of concrete methods onRequestBuf - Streamlined initialization: Replaced separate
new_splice_buffer()andnew_fallback_buffer()methods with a singlenew_request_buffer()that automatically selects the appropriate implementation
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/buf.rs | Consolidates buffer types into RequestBuf with internal BufKind enum; removes trait abstractions; adds RemainingData enum for uniform handling of remaining data |
| src/session.rs | Updates API to use RequestBuf and removes generic type parameters; replaces separate buffer creation methods with unified new_request_buffer() |
| src/connect.rs | Updates to use new RequestBuf::new_vec() constructor during connection initialization |
| examples/poll.rs | Updates to use new_request_buffer() instead of new_splice_buffer() |
| examples/hello.rs | Updates to use new_request_buffer() instead of new_splice_buffer() |
| examples/heartbeat_entry.rs | Updates to use new_request_buffer() instead of new_splice_buffer() |
| examples/heartbeat.rs | Updates to use new_request_buffer() and adds mut to remains binding for io::Read usage |
| examples/basic.rs | Updates to use new_request_buffer() instead of new_fallback_buffer() and handles Result type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #261.