Skip to content

Simplify the interface around request buffer#262

Merged
ubnt-intrepid merged 1 commit intomainfrom
simplify-request-buf
Dec 11, 2025
Merged

Simplify the interface around request buffer#262
ubnt-intrepid merged 1 commit intomainfrom
simplify-request-buf

Conversation

@ubnt-intrepid
Copy link
Copy Markdown
Owner

Fixes #261.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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: SpliceBuf and FallbackBuf are now internal variants of RequestBuf
  • Simplified API: Removed TryReceive and ToParts traits in favor of concrete methods on RequestBuf
  • Streamlined initialization: Replaced separate new_splice_buffer() and new_fallback_buffer() methods with a single new_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

@ubnt-intrepid ubnt-intrepid merged commit 504e659 into main Dec 11, 2025
9 checks passed
@ubnt-intrepid ubnt-intrepid deleted the simplify-request-buf branch December 11, 2025 14:50
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.

FallbackBuf と SpliceBuf の使い分けを止める

2 participants