Skip to content

feat(io): make bytes optional#750

Merged
Berrysoft merged 4 commits intocompio-rs:masterfrom
George-Miao:feat/io/optional-bytes
Mar 10, 2026
Merged

feat(io): make bytes optional#750
Berrysoft merged 4 commits intocompio-rs:masterfrom
George-Miao:feat/io/optional-bytes

Conversation

@George-Miao
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings March 10, 2026 00:35
@George-Miao George-Miao self-assigned this Mar 10, 2026
@George-Miao George-Miao added enhancement New feature or request package: io Related to compio-io labels Mar 10, 2026
@George-Miao George-Miao force-pushed the feat/io/optional-bytes branch from e700a53 to 0533c6e Compare March 10, 2026 00:36
Copy link
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 makes the bytes integration in compio-io feature-gated so consumers can build without pulling in bytes via compio-buf, while keeping the previous behavior enabled by default.

Changes:

  • Gate framed::codec::bytes and BytesFramed behind a new bytes feature (enabled by default).
  • Update compio-io’s dependency on compio-buf to no longer always enable its bytes feature.
  • Replace bytes-trait-based length encoding/decoding in LengthDelimited with a std::io::Write-based approach.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
compio-io/src/framed/mod.rs Adds a BytesFramed alias behind feature = "bytes" and updates docs/imports accordingly.
compio-io/src/framed/frame.rs Reworks LengthDelimited header encoding/decoding to avoid bytes traits.
compio-io/src/framed/codec/mod.rs Gates the bytes codec module behind feature = "bytes".
compio-io/Cargo.toml Removes unconditional compio-buf/bytes dependency feature and introduces a bytes feature (default-on).

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

@George-Miao George-Miao force-pushed the feat/io/optional-bytes branch 4 times, most recently from 7bcf228 to 9d5c55f Compare March 10, 2026 01:19
@George-Miao George-Miao force-pushed the feat/io/optional-bytes branch 5 times, most recently from 391e0f7 to 80979f9 Compare March 10, 2026 15:15
@George-Miao
Copy link
Member Author

Just to clarify on the panicking: By default bytes' Buf and BufMut's non-try_ methods will also panic in case of overly large LFL. This change just makes it panic during initialization instead of runtime.

@George-Miao George-Miao force-pushed the feat/io/optional-bytes branch 2 times, most recently from 03ed564 to e1c3990 Compare March 10, 2026 16:58
@George-Miao George-Miao force-pushed the feat/io/optional-bytes branch from e1c3990 to 5d08d9f Compare March 10, 2026 17:27
Co-authored-by: Yuyi Wang <Strawberry_Str@hotmail.com>
Copy link
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.

LGTM

@Berrysoft Berrysoft merged commit a745c5e into compio-rs:master Mar 10, 2026
63 checks passed
@George-Miao George-Miao deleted the feat/io/optional-bytes branch March 10, 2026 18:22
@github-actions github-actions bot mentioned this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request package: io Related to compio-io

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants