Skip to content

http::Body: add bytes_contents, like contents but gives Bytes#132

Merged
pchickey merged 1 commit into
mainfrom
pch/body_bytes_contents
Jun 16, 2026
Merged

http::Body: add bytes_contents, like contents but gives Bytes#132
pchickey merged 1 commit into
mainfrom
pch/body_bytes_contents

Conversation

@pchickey

@pchickey pchickey commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Its trivial for the library to provide this efficient implementation with a clone of the Bytes already inside the struct, but building one out of the contents method will be inefficient and cost a copy.

Since the Body constructors includes From<Bytes>, this makes a corresponding accessor.

Its trivial for the library to provide this efficient implementation,
but building one out of the `contents` method will be inefficient and
cost a copy.

Since the Body constructors includes From<Bytes>, this makes a
corresponding accessor.
@pchickey pchickey requested a review from yoshuawuyts June 15, 2026 22:19
@pchickey pchickey merged commit 63e6e91 into main Jun 16, 2026
5 checks passed
@pchickey pchickey deleted the pch/body_bytes_contents branch June 16, 2026 18:27
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.

2 participants