bytes icon indicating copy to clipboard operation
bytes copied to clipboard

Add `BytesMut::try_reserve()`

Open poliorcetics opened this issue 2 years ago • 9 comments

I rebased #521.

While I do not claim this implements #484, I think the review was too harsh: BytesMut is the only API with a reserve method, adding other fallible allocations APIs should not be done in this MR.

poliorcetics avatar May 19 '23 14:05 poliorcetics

Hello, I also need this. Any way we can get this merged?

roblabla avatar Oct 10 '24 21:10 roblabla

Actually, it seems like Vec::try_reserve is not available on our minimum supported rust version.

Darksonn avatar Oct 17 '24 12:10 Darksonn

Vec::try_reserve has been in Rust since 1.57, which was released in December 2, 2021 (almost three years ago). Is there any plan on raising the MSRV anytime soon? Otherwise would you accept a PR gating this API behind a feature gate?

roblabla avatar Oct 23 '24 22:10 roblabla

Given that even syn is at 1.61, I think a bump to 1.57 is fine.

djc avatar Oct 24 '24 11:10 djc

Any chance the MSRV can finally get a bump so this PR could get merged?

rrauch avatar Jul 15 '25 15:07 rrauch

I'll add that even Yocto Kirkstone is on a version newer than the proposed MSRV (they're at 1.59), so I don't really see anyone still stuck on < 1.57. There's still Debian Bullseye, but after 4 years since the release and 1 year of LTS still left, it's basically dead.

paolobarbolini avatar Jul 15 '25 15:07 paolobarbolini

I've opened a PR for the MSRV bump #788

paolobarbolini avatar Jul 15 '25 16:07 paolobarbolini

https://github.com/tokio-rs/bytes/pull/788 has been merged so this now should be ready to be rebased

paolobarbolini avatar Jul 16 '25 08:07 paolobarbolini

I've opened #789 as an alternative to this.

paolobarbolini avatar Jul 26 '25 17:07 paolobarbolini