From 94e42915a9a4bac7c2fbaa3d94f27bf0eb4dfb14 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Fri, 28 Nov 2025 10:02:34 +0100 Subject: [PATCH] Document that `BytesMut::{reserve,try_reserve}` doesn't preserve unused capacity (#808) --- src/bytes_mut.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index 565e91d..fe6dbc7 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 /// /// ```