Skip to content

Reserve capacity in BytesMut::put#794

Merged
Darksonn merged 1 commit intotokio-rs:masterfrom
stepancheg:bytes-mut-put-reserve
Aug 19, 2025
Merged

Reserve capacity in BytesMut::put#794
Darksonn merged 1 commit intotokio-rs:masterfrom
stepancheg:bytes-mut-put-reserve

Conversation

@stepancheg
Copy link
Copy Markdown
Contributor

@stepancheg stepancheg commented Aug 18, 2025

Copy-paste code from Vec::put

bytes/src/buf/buf_mut.rs

Lines 1645 to 1646 in 3e44f88

// In case the src isn't contiguous, reserve upfront.
self.reserve(src.remaining());

Copy link
Copy Markdown
Member

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn merged commit 016fdbd into tokio-rs:master Aug 19, 2025
18 checks passed
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