From 70efacc8679cb3e3a59e104a8835583967f2c255 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Mon, 24 Nov 2025 00:05:37 +0100 Subject: [PATCH] Document that `BytesMut::{reserve,try_reserve}` doesn't preserve unused capacity --- src/bytes_mut.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index 565e91d9b..fe6dbc733 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -551,6 +551,8 @@ impl BytesMut { /// and the original buffer is large enough to fit the requested additional /// capacity, then reallocations will never happen. /// + /// This method does not preserve data stored in the unused capacity. + /// /// # Examples /// /// In the following example, a new buffer is allocated. @@ -797,6 +799,8 @@ impl BytesMut { /// references through other `BytesMut`s or `Bytes` which point to the same underlying /// storage. /// + /// This method does not preserve data stored in the unused capacity. + /// /// # Examples /// /// ```