Skip to content

fix(io): Framed won't stop reading if underlying IO returns Ok(0)#497

Merged
Berrysoft merged 4 commits into
compio-rs:masterfrom
George-Miao:fix/io-eof
Oct 29, 2025
Merged

fix(io): Framed won't stop reading if underlying IO returns Ok(0)#497
Berrysoft merged 4 commits into
compio-rs:masterfrom
George-Miao:fix/io-eof

Conversation

@George-Miao
Copy link
Copy Markdown
Member

No description provided.

@George-Miao George-Miao requested review from Berrysoft and Copilot and removed request for Berrysoft October 29, 2025 02:37
@George-Miao George-Miao self-assigned this Oct 29, 2025
@George-Miao George-Miao added package: io Related to compio-io bug Something isn't working labels Oct 29, 2025
@George-Miao George-Miao requested a review from Berrysoft October 29, 2025 02:37
@George-Miao George-Miao changed the title fix(io): Framed won't stop reading if underlying IO returns Ok(0)Fix/io eof fix(io): Framed won't stop reading if underlying IO returns Ok(0) Oct 29, 2025
@George-Miao George-Miao changed the title fix(io): Framed won't stop reading if underlying IO returns Ok(0) fix(io): Framed won't stop reading if underlying IO returns Ok(0) Oct 29, 2025
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 refactors the Framed module by restructuring internal state management, moving tests to a separate file, and improving documentation. The changes enhance encapsulation by making internal state transition methods private and introducing proper constructor methods.

  • Wrapped read state in a new State structure with an eof field to properly track end-of-file
  • Introduced constructor methods (new() and empty()) for both read and write states, improving API consistency
  • Moved test code from inline module to a dedicated test file in compio-io/tests/framed.rs

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
compio-io/tests/framed.rs New dedicated test file containing the framed functionality test previously in serde_json.rs
compio-io/src/framed/write.rs Refactored state management with new constructors, made internal methods private, and reorganized code layout
compio-io/src/framed/read.rs Introduced State wrapper struct with eof tracking and migrated from direct enum to inner/outer state pattern
compio-io/src/framed/mod.rs Updated to use new state constructors and improved documentation with specific examples
compio-io/src/framed/codec/serde_json.rs Removed inline test module (moved to dedicated test file)
compio-io/Cargo.toml Added test configuration for the new framed test file with required features

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread compio-io/src/framed/write.rs Outdated
Comment thread compio-io/src/framed/write.rs Outdated
Comment thread compio-io/src/framed/write.rs Outdated
Copy link
Copy Markdown
Member

@Berrysoft Berrysoft left a comment

Choose a reason for hiding this comment

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

Copilot is right.

@George-Miao George-Miao requested a review from Berrysoft October 29, 2025 03:07
@Berrysoft Berrysoft merged commit 19d2104 into compio-rs:master Oct 29, 2025
50 checks passed
@George-Miao George-Miao deleted the fix/io-eof branch December 16, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working package: io Related to compio-io

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants